Viitor_upstart/etc/init/nfsroot.conf

39 lines
1.3 KiB
Plaintext
Raw Normal View History

description "Special Handling for nfs / (root) Filesystem"
author "Harald Kueller <harald.kueller@compuextreme.de>"
version 1.0
emits none special
start on varmake
console output
script
source /etc/init/functions
mount -t tmpfs none /var
status_message "Mount tmpfs on /var"
ifconfig|\
grep Protokoll|\
awk '{ if ( $2 == "Protokoll:Ethernet" ) print $1 }' >/var/devices
for i in `cat /var/devices`; do
INET=`ifconfig $i|\
grep inet|\
awk -F ":" '{print $2}'|\
awk '{print $1}'`
ANET=`echo $INET|awk -F "." '{print $1}'`
if [ ! "$ANET" == "127" ]; then
HOSTNAME=`getent hosts $INET`
HOSTNAME=`echo $HOSTNAME|\
awk '{print $2}'|\
awk -F "." '{print $1}'`
break
fi
done
status_message "Getting Hostname $HOSTNAME.."
cd /var
tar -zxf /boot/var_${HOSTNAME}.tgz
echo $HOSTNAME >etc/sysconfig/nodename
cd -
status_message "Restore of /var folder"
umount /proc
/sbin/initctl mount_virtual
end script