ipon 741 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #!/bin/rc
  2. # ipon [-g gwv4] ipv4 mask [netdir etherno ndbroot] - enable IP on netdir &
  3. # ether-and-ip-stack-no with address ipv4 & optional ipv4 gateway gwv4
  4. rfork e
  5. fn usage {
  6. echo usage: ipon '[-g gwv4] ipv4 mask [netdir ether&stack-no [ndbroot]]' >[1=2]
  7. exit usage
  8. }
  9. switch ($1) {
  10. case -g
  11. gw=(-g $2)
  12. shift 2
  13. case -*
  14. usage
  15. }
  16. switch ($#*) {
  17. case 2
  18. netdir=/net
  19. etherno=0
  20. ndbroot=/lib/ndb/local
  21. case 4
  22. netdir=$3
  23. etherno=$4
  24. case 5
  25. netdir=$3
  26. etherno=$4
  27. ndbroot=$5
  28. case *
  29. usage
  30. }
  31. ipv4=$1
  32. mask=$2
  33. bind -b '#l'$etherno $netdir
  34. bind -b '#I'$etherno $netdir
  35. ip/ipconfig -x $netdir $gw ether $netdir/ether$etherno $ipv4 $mask
  36. if (~ $#ndbroot 1) {
  37. ndb/cs -x $netdir -f $ndbroot
  38. ndb/dns -r -x $netdir -f $ndbroot
  39. }
  40. if not
  41. exit ''