1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
#!/bin/sh
if [ $$ -ne 1 ]
then
exec /sbin/init.orig $*
echo "FATAL ERROR: exec /sbin/init.orig failed"
exit 1
fi
if [ -f /etc/diskless-image/config ]
then
mount -n none /proc -t proc
#IP=`cat /proc/cmdline | sed 's/^.*nfsaddrs=\([0-9\.]\+\).*$/\1/'`
IP=`ifconfig | grep -A1 eth0 | grep -v eth0 | sed 's/^.*inet addr:\([0-9\.]\+\).*$/\1/'`
echo IP address is $IP
. /etc/diskless-image/config
fi
if touch /test-rw
then
rm /test-rw
echo "WARNING: master system installed"
exec /sbin/init.orig $*
echo "FATAL ERROR: exec /sbin/init.orig failed"
exit 1
fi
if [ -f /etc/diskless-image/config ]
then
echo -n "Mounting NFS-root directories..."
mount -n $nfsserver:/$nfshostsdir/$IP/etc /etc -orw,nolock
rm -f /etc/mtab~ /etc/nologin
: > /etc/mtab
mount -o remount /
mount -o remount /etc
mount -o remount /proc
echo "done."
else
echo "Not mounting NFS-root directories"
fi
exec /sbin/init.orig $*
echo "FATAL ERROR: exec /sbin/init.orig failed"
exit 1
|