Annotation of elwix/config/etc/rootfs/rc, revision 1.1.1.1.6.9
1.1 misho 1: #!/bin/sh
2: #
3: # Boot startup script for ELWIX RootFS ...
4: #
1.1.1.1.6.9! misho 5: # $Id: rc,v 1.1.1.1.6.8 2012/10/09 12:23:38 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.1.1.1.6.6 misho 21: FRMDEV="md1"
22: FRMSIZE="82m"
23: FRMFILE="elwix-firmware.sys"
24: FRMPATH="/elwix"
25:
1.1.1.1.6.1 misho 26: FIT2CF="/dev/ufs/fit2cf"
27: CFDIR="/elwix/cf"
28:
1.1 misho 29: umask 022
30:
31: failed_sysvol()
32: {
1.1.1.1.6.1 misho 33: echo " RootFS: Failed $1 ELWIX $2 ... Go to emergency shell !!!"
1.1 misho 34:
35: exit 127
36: }
37:
38: boot_elwix()
39: {
1.1.1.1.6.5 misho 40: echo " RootFS: Loading ELWIX system firmware"
1.1.1.1.6.6 misho 41: if test ! -r $FRMPATH/$FRMFILE; then
42: echo " RootFS: WARNING! Failed default firmware image!"
43: echo " RootFS: Try to load ELWIX backup firmware ..."
44:
45: FRMPATH="$FRMPATH/altroot"
46: if test ! -r $FRMPATH/$FRMFILE; then
47: failed_sysvol "load backup and default image" elwix-firmware.sys
1.1.1.1.6.2 misho 48: fi
1.1 misho 49: fi
1.1.1.1.6.6 misho 50:
51: mdmfs -s $FRMSIZE -S -m0 -oasync $FRMDEV /usr
52: cd /usr
1.1.1.1.6.7 misho 53: pax -r -z -pe -f $FRMPATH/$FRMFILE
1.1.1.1.6.8 misho 54: cd -
55: mount -ur /usr
1.1.1.1.6.6 misho 56:
1.1 misho 57: sleep 2
58: }
59:
1.1.1.1.6.9! misho 60: mount_usr()
! 61: {
! 62: echo " RootFS: Mounting ELWIX system image"
! 63:
! 64: mount -t nullfs -r $FRMPATH/usr /usr
! 65: }
! 66:
1.1 misho 67: #
68: ## main()
69: #
70:
71: echo "ELWIX>>> Firmware RootFS boot stage ..."
72: echo " RootFS: Mount ELWIX system volume"
73: fsck -q -y 1>/dev/null 2>&1 && mount -a || fsck -y 1>/dev/null 2>&1 && mount -a || \
1.1.1.1.6.1 misho 74: fsck -f -y 1>/dev/null 2>&1 && mount -a || failed_sysvol mount "system volume"
75:
76: if test -c $FIT2CF -a -d $CFDIR; then
77: echo " RootFS: Mount ELWIX flash volume"
78: fsck -y -tufs $FIT2CF 1>/dev/null 2>&1 && mount -o ro $FIT2CF $CFDIR || \
79: fsck -f -y -tufs $FIT2CF 1>/dev/null 2>&1 && mount -o ro $FIT2CF $CFDIR || \
80: failed_sysvol mount "flash volume"
81: fi
1.1 misho 82:
1.1.1.1.6.5 misho 83: if [ -r /elwix/elwix-firmware.sys ]; then
84: boot_elwix
85: else
1.1.1.1.6.9! misho 86: if [ -d $FRMPATH/usr ]; then
! 87: mount_usr
! 88: else
! 89: echo " RootFS: Skip loading ELWIX system firmware ..."
! 90: fi
1.1.1.1.6.5 misho 91: fi
1.1 misho 92:
1.1.1.1.6.4 misho 93: exec /etc/rc.init
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>