configether 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #!/bin/rc
  2. # desc: configure your internet connection via an ethernet card
  3. switch($1) {
  4. case go
  5. echo
  6. echo 'Please choose a method for configuring your ethernet connection.'
  7. echo
  8. echo ' manual - specify IP address, network mask, gateway IP address'
  9. echo ' dhcp - use DHCP to automatically configure'
  10. echo
  11. prompt 'Configuration method' manual dhcp
  12. ethermethod=$rd
  13. gwaddr=xxx
  14. ipaddr=xxx
  15. ipmask=xxx
  16. switch($ethermethod){
  17. case dhcp
  18. echo
  19. echo 'Some ISPs, notably @HOME, require a host name passed with DHCP'
  20. echo 'requests. An example for @HOME would be "cc1018221-a". If your'
  21. echo 'ISP supplied you such a name, enter it.'
  22. echo
  23. prompt -d none 'host name'; dhcphost=$rd
  24. switch($dhcphost){
  25. case none
  26. dhcphost=();
  27. case *
  28. dhcphost=(-h $dhcphost)
  29. }
  30. export dhcphost
  31. case manual
  32. prompt 'ip address'; ipaddr=$rd
  33. prompt 'network mask'; ipmask=$rd
  34. prompt 'gateway address'; gwaddr=$rd
  35. export ipaddr ipmask gwaddr
  36. }
  37. export ethermethod gwaddr ipaddr ipmask dhcphost
  38. exec startether go
  39. case checkdone
  40. if(! ~ $ethermethod manual dhcp) {
  41. configether=notdone
  42. export configether
  43. }
  44. if(~ $ethermethod manual && ~ 0 $#ipaddr $#ipmask $#gwaddr) {
  45. configether=notdone
  46. export configether
  47. }
  48. }