#!/bin/rc # # If you will be using DHCP, you should create a log file for it: # disk/kfscmd 'create /sys/log/dhcp sys sys 666 al' # otherwise the DHCP messages will come out on the console # fn run { echo $* eval $* } fn try { ip=`{ndb/query sys $1 ip} if(~ $#ip 0) { echo no ip address for $1 echo fail } ipgw=`{ndb/query sys $1 ipgw} if(~ $#ipgw 0) { echo warning: no ip gateway for $1 >[1=2] gw='' } if not gw='-g'$ipgw ipmask=`{ndb/query sys $1 ipmask} if(~ $#ipmask 0) { echo no ip mask for $1 >[1=2] echo fail } run ip/ipconfig $gw ether /net/ether0 add $ip $ipmask >[1=2] echo ok } while() { echo -n 'system name [dhcp]: ' x=`{read} if(~ $#x 0) { ip/ipconfig -dD >> /sys/log/dhcp >[2=1] exit } if(~ `{try $x} ok) exit }