Annotation of elwix/config/etc/rootfs/rc, revision 1.4

1.1       misho       1: #!/bin/sh
                      2: #
                      3: # Boot startup script for ELWIX RootFS ...
                      4: #
1.4     ! misho       5: # $Id: rc,v 1.2.2.4 2013/01/28 10:33:26 misho Exp $
1.1       misho       6: 
                      7: stty status '^T'
                      8: 
                      9: trap : 2
                     10: trap : 3
                     11: trap : 18
                     12: 
                     13: HOME=/root
                     14: PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/pkg/bin:/usr/pkg/sbin:/usr/local/bin:/usr/local/sbin
                     15: TERM=xterm
                     16: BLOCKSIZE=1k
                     17: EDITOR=vi
                     18: PAGER=less
                     19: export HOME PATH TERM BLOCKSIZE EDITOR PAGER
                     20: 
1.2       misho      21: FRMDEV="md1"
                     22: FRMSIZE="41m"
                     23: FRMFILE="elwix-firmware.sys"
                     24: 
                     25: FRMDEV2="md2"
1.3       misho      26: FRMSIZE2="21m"
1.2       misho      27: FRMFILE2="elwix-firmware2.sys"
                     28: 
                     29: FRMPATH="/elwix"
                     30: FIT2CF="/dev/ufs/fit2cf"
                     31: CFDIR="/elwix/cf"
                     32: 
1.1       misho      33: umask 022
                     34: 
                     35: failed_sysvol()
                     36: {
1.2       misho      37:        echo " RootFS: Failed $1 - $2 ... Go to emergency shell !!!"
1.1       misho      38: 
                     39:        exit 127
                     40: }
                     41: 
                     42: boot_elwix()
                     43: {
1.2       misho      44:        echo " RootFS: Loading ELWIX system firmware"
                     45: 
                     46:        mdmfs -s $FRMSIZE -S -m0 -oasync $FRMDEV /usr
                     47:        if [ "$?" != "0" ]; then
                     48:                failed_sysvol "to mount firmware image " $FRMFILE
1.1       misho      49:        fi
1.2       misho      50:        cd /usr
                     51:        pax -r -z -pe -f $FRMPATH/$FRMFILE
                     52:        if [ "$?" != "0" ]; then
                     53:                failed_sysvol "to load firmware image " $FRMFILE
                     54:        fi
                     55:        cd -
                     56:        mount -ur /usr
                     57: }
1.1       misho      58: 
1.2       misho      59: boot_elwix2()
                     60: {
                     61:        echo " RootFS: Loading ELWIX secondary firmware"
                     62: 
                     63:        mdmfs -s $FRMSIZE2 -S -m0 -oasync $FRMDEV2 /usr/local
                     64:        if [ "$?" != "0" ]; then
                     65:                failed_sysvol "to mount firmware image " $FRMFILE2
                     66:        fi
                     67:        cd /usr/local
                     68:        pax -r -z -pe -f $FRMPATH/$FRMFILE2
                     69:        if [ "$?" != "0" ]; then
                     70:                failed_sysvol "to load firmware image " $FRMFILE2
                     71:        fi
                     72:        cd -
                     73:        mount -ur /usr/local
                     74: }
                     75: 
                     76: mount_usr()
                     77: {
                     78:        echo " RootFS: Mounting ELWIX system image"
                     79: 
                     80:        mount -t nullfs -r $FRMPATH/usr /usr
                     81:        if [ "$?" != "0" ]; then
                     82:                failed_sysvol "to mount system image " $FRMFILE
                     83:        fi
1.1       misho      84: }
                     85: 
                     86: #
                     87: ## main()
                     88: #
                     89: 
                     90: echo "ELWIX>>> Firmware RootFS boot stage ..."
                     91: echo " RootFS: Mount ELWIX system volume"
1.4     ! misho      92: fsck -y 1>/dev/null 2>&1 && mount -a || fsck -y 1>/dev/null 2>&1 && mount -a || \
1.2       misho      93:        fsck -f -y 1>/dev/null 2>&1 && mount -a || failed_sysvol mount "system volume"
                     94: 
1.4     ! misho      95: if test -c "$FIT2CF" -a -d "$CFDIR"; then
1.2       misho      96:        echo " RootFS: Mount ELWIX flash volume"
                     97:        fsck -y -tufs $FIT2CF 1>/dev/null 2>&1 && mount -o ro $FIT2CF $CFDIR || \
                     98:                failed_sysvol mount "flash volume"
                     99: fi
                    100: 
                    101: if [ -r $FRMPATH/$FRMFILE ]; then
                    102:        boot_elwix
                    103: else
                    104:        if [ -d $FRMPATH/usr ]; then
                    105:                mount_usr
                    106:        else
                    107:                echo " RootFS: Skip loading ELWIX system firmware ..."
                    108:        fi
                    109: fi
1.1       misho     110: 
1.2       misho     111: if [ -r $FRMPATH/$FRMFILE2 ]; then
                    112:        boot_elwix2
                    113: fi
1.1       misho     114: 
1.2       misho     115: exec /etc/rc.init

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>