configppp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #!/bin/rc
  2. # desc: configure your internet connection via ppp over a modem
  3. switch($1) {
  4. case go
  5. devs=`{ls -p '#t/'eia? >[2]/dev/null}
  6. if(~ $#devs 0) {
  7. echo 'No serial port found; this can''t happen.' # because configip checks
  8. exit
  9. }
  10. # not going to use the mouse for PPP
  11. if(~ eia^$mouseport $devs)
  12. devs=`{echo $devs | sed 's/eia'^$mouseport^'//'}
  13. if(~ $#devs 0) {
  14. echo 'The only serial port you have is your mouse.'
  15. echo 'Cannot configure PPP.'
  16. exit
  17. }
  18. echo
  19. echo 'Please choose the serial port or modem to use to connect to your ISP.'
  20. echo
  21. for(i in $devs) {
  22. n=`{echo $i | sed 's/eia//'}
  23. n=`{hoc -e 1+$n}
  24. echo ' '^$i^'(Windows'' COM'^$n^')'
  25. }
  26. echo
  27. prompt 'Serial device' $devs
  28. pppdev=$rd
  29. echo
  30. echo 'Pick a baud rate for the PPP connection.'
  31. echo
  32. prompt -d 115200 'Baud rate'
  33. pppbaud=$rd
  34. echo
  35. echo 'You can specify your dialup phone number, username, and password,'
  36. echo 'or you can log in manually by typing the modem commands yourself.'
  37. echo
  38. prompt 'Dialing method' auto manual
  39. pppmethod=$rd
  40. switch($pppmethod){
  41. case auto
  42. prompt 'PPP phone number'; pppphone=$rd
  43. prompt 'PPP phone username'; pppuser=$rd
  44. prompt 'PPP phone password'; ppppasswd=$rd
  45. }
  46. export pppdev pppmethod pppphone ppppasswd pppuser pppbaud
  47. exec startppp go
  48. case checkdone
  49. if(! ~ $#pppmethod 1 || ! test -f /dev/$pppdev){
  50. configppp=notdone
  51. export configppp
  52. }
  53. }