From 03c9f97c49c93f1979a0f568c1f9b22c619d9590 Mon Sep 17 00:00:00 2001 From: Dirk von Suchodoletz Date: Fri, 7 Apr 2006 04:41:50 +0000 Subject: fix for ip= line configuration problem with etherboot git-svn-id: http://svn.openslx.org/svn/openslx/ld4@172 95ad53e4-c205-0410-b2fa-d234c58c8868 --- initrd/initrd-stuff/init | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'initrd') diff --git a/initrd/initrd-stuff/init b/initrd/initrd-stuff/init index a3af01d5..859bbbfb 100755 --- a/initrd/initrd-stuff/init +++ b/initrd/initrd-stuff/init @@ -2,11 +2,11 @@ # Description: main script for new type of initial ramdisk for # linux diskless clients version 4 # -# Author(s): Dirk von Suchodoletz , 06-04-2006 +# Author(s): Dirk von Suchodoletz , 07-04-2006 # # Copyright: (c) 2006 - RZ Universitaet Freiburg # -# Version: 0.2.4c +# Version: 0.2.4d # functions common for all distros, messages contains all error and info # output @@ -183,12 +183,16 @@ ipsetup 127.0.0.1 255.0.0.0 0.0.0.0 127.255.255.255 lo # analyze ip information from the kernel command line and put parts # of it into several variables if [ -n "$IPINFO" ] ; then - IP=`echo $IPINFO|sed -e "s/:.*//"` - SERVER=`echo $IPINFO|sed -e "s/[0-9\.]\{3,\}://;s/:.*//"` - GW=`echo $IPINFO|sed -e "s/[0-9\.]\{3,\}:[0-9\.]\{3,\}://;s/:.*//"` - # remove last colon after netmask if it was left there ... - IPINFO=`echo $IPINFO|sed -e "s/:$//"` - NM=`echo $IPINFO|sed -e "s/.*://"` + getip () { + val=$IPINFO; i=$(expr $1 - 1); + while [ $i -gt 0 ] ; do + val=${val#*:} ; i=$(expr $i - 1); + done; + echo $val|sed "s/:.*//"; } + IP=$(getip 1) + SERVER=$(getip 2) + GW=$(getip 3) + NM=$(getip 4) echo -e "# ip configuration written by $0 script\nclientip=$IP\n\ sub_netmask=$NM\ngateway=$GW\nserverip=$SERVER" \ >>/etc/machine-setup @@ -442,5 +446,6 @@ umount -n /proc [ -n "${UNIONFS}" ] && mount -n --move /root /mnt/mnt # unset old environment variables unset debug date initrd ip nfsroot vci -# new style of pivoting +unset KERNEL NWMODULES +# new style of pivoting (exec -c would set an empty environment in bash) exec run-init -c dev/console /mnt /sbin/init || error "$init_runinit" -- cgit v1.2.3-55-g7522