You can replace the binary produced by boot.c by a shell script as follows:

in your kernel config file, change the 'bootdir' section to
include all the programmes you will use in the shell script, e.g.

        bootdir
                /386/bin/rc
                /rc/lib/rcmain
                /386/bin/bind
                /386/bin/sed
                /386/bin/srv
                /386/bin/cat
                /386/bin/cp
                /386/bin/rm
                /386/bin/echo
                /386/bin/mount
                /386/bin/sleep
                /386/bin/ip/ipconfig
                /386/bin/auth/factotum
                /386/bin/ls
                /386/bin/ps
                /386/bin/auth/wrkey
                boot.rc boot

and in the appropriate kernel architecture subdirectory (in this
case '386') create the shell script you want to run as /boot in
boot.rc, e.g.

        #!/boot/rc -m /boot/rcmain
        
        cpuserver=yes
        cd /boot
        echo boot...
        bind -a '#I' /net
        bind -a '#l0' /net
        bind -a '#S' /dev
        bind '#p' /proc
        bind '#d' /fd
        bind -a /boot /
        
        ipconfig -D
        
        authaddr=`{sed -n 's/   auth=(.*)/\1/p' /net/ndb|sed 1q}
        if(~ $authaddr '')
                authaddr=xxx.xxx.xxx.xxx
        fsaddr=`{sed -n 's/     fs=(.*)/\1/p' /net/ndb|sed 1q}
        if(~ $fsaddr '')
                fsaddr=xxx.xxx.xxx.xxx
        
        factotum -sfactotum -S -a $authaddr
        
        if(! srv tcp!$fsaddr!564 boot)
                exec ./rc -m/boot/rcmain -i
        
        if(! mount -c /srv/boot /root)
                exec ./rc -m/boot/rcmain -i
        
        bind -ac /root /
        rootdir=/root
        rootspec=''
        /$cputype/init -c
        exec ./rc -m/boot/rcmain -i

where xxx.xxx.xxx.xxx is replaced by local default ip addresses
for the auth and file servers.

--jim

Reply via email to