Annotation of elwix/config/etc/default/rc, revision 1.3.2.4
1.2 misho 1: #!/bin/sh
2: #
1.3 misho 3: # Boot startup script for ELWIX BaseFS ...
1.2 misho 4: #
1.3.2.4 ! misho 5: # $Id: rc,v 1.3.2.3 2017/06/19 20:26:48 misho Exp $
1.2 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.3.2.4 ! misho 21: ETCDEV="md1"
! 22: ETCSIZE="8m"
! 23:
1.3.2.3 misho 24: FRMDEV2="md4"
1.2 misho 25: FRMSIZE2="21m"
26: FRMFILE2="elwix-firmware2.sys"
27:
28: FRMPATH="/elwix"
29: FIT2CF="/dev/ufs/fit2cf"
30: CFDIR="/elwix/cf"
31:
1.3.2.4 ! misho 32: ELWIX2="/dev/ufs/elwix2"
! 33:
1.2 misho 34: umask 022
35:
36: failed_sysvol()
37: {
1.3 misho 38: echo " BaseFS: Failed $1 - $2 ... Go to emergency shell !!!"
1.2 misho 39:
40: exit 127
41: }
42:
43: boot_elwix2()
44: {
1.3 misho 45: echo " BaseFS: Loading ELWIX secondary firmware"
1.2 misho 46:
1.3.2.4 ! misho 47: mdmfs -s $FRMSIZE2 -S -n -m0 -oasync $FRMDEV2 /elwix/pkg
1.3 misho 48: if test $? -ne 0; then
1.2 misho 49: failed_sysvol "to mount firmware image " $FRMFILE2
50: fi
1.3.2.1 misho 51: cd /elwix/pkg
1.2 misho 52: pax -r -z -pe -f $FRMPATH/$FRMFILE2
1.3 misho 53: if test $? -ne 0; then
1.2 misho 54: failed_sysvol "to load firmware image " $FRMFILE2
55: fi
56: cd -
1.3.2.1 misho 57: mount -ur /elwix/pkg || failed_sysvol mount "secondary firmware"
1.2 misho 58: }
59:
60: #
61: ## main()
62: #
63:
1.3 misho 64: echo "ELWIX>>> Firmware BaseFS boot stage ..."
65:
1.3.2.4 ! misho 66: if test -c $ELWIX2; then
! 67: BOOTSLICE=`kenv currdev`
! 68: if test "${BOOTSLICE#disk0}" != "a:"; then
! 69: mount -o ro $ELWIX2 /
! 70: else
! 71: mount /
! 72: fi
! 73: else
! 74: mount /
! 75: fi
! 76:
1.3 misho 77: if ! mount -a; then
78: umount -A
79: fsck -y 1>/dev/null 2>&1
80: if ! mount -a; then
81: umount -A -f
82: fsck -f -y 1>/dev/null 2>&1
83: if ! mount -a; then
84: failed_sysvol mount "system volume"
85: fi
86: fi
87: fi
1.2 misho 88:
89: if test -c "$FIT2CF" -a -d "$CFDIR"; then
1.3 misho 90: echo " BaseFS: Mount ELWIX flash volume"
1.3.2.4 ! misho 91: mount -o ro $FIT2CF $CFDIR || \
1.3 misho 92: fsck -y -tufs $FIT2CF 1>/dev/null 2>&1 && mount -o ro $FIT2CF $CFDIR || \
1.2 misho 93: failed_sysvol mount "flash volume"
94: fi
95:
1.3 misho 96: if test -r "$FRMPATH/$FRMFILE2"; then
1.2 misho 97: boot_elwix2
98: fi
99:
100: exec /etc/rc.init
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>