diff options
author | Dirk von Suchodoletz | 2008-03-05 01:57:09 +0100 |
---|---|---|
committer | Dirk von Suchodoletz | 2008-03-05 01:57:09 +0100 |
commit | 0d19cd55845a477c9debf545c62eb89d82b04eb8 (patch) | |
tree | fccb0e0a5b22740fe6bdb6c4ff5a960fd4863f30 /initramfs | |
parent | Fixes for DNDB2 in SLX init, update of mkcdboot.uclib with ipcalc (diff) | |
download | core-0d19cd55845a477c9debf545c62eb89d82b04eb8.tar.gz core-0d19cd55845a477c9debf545c62eb89d82b04eb8.tar.xz core-0d19cd55845a477c9debf545c62eb89d82b04eb8.zip |
Optimized init for Preboot CD/ISO to handle different start behaviours
of machines ...
git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@1599 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'initramfs')
-rwxr-xr-x | initramfs/cdboot/init | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/initramfs/cdboot/init b/initramfs/cdboot/init index 499768f9..e8d42e27 100755 --- a/initramfs/cdboot/init +++ b/initramfs/cdboot/init @@ -12,7 +12,26 @@ # Main script for cd-boot demo initial ramfs - preloading environment for # for running OpenSLX linux stateless clients version 4 for testing - +fetchip () { +# we expect to get an ip address within 10++ seconds +( sleep 6 ; killall udhcpc >/dev/null 2>&1 ) & +for i in 1 2 ; do + udhcpc -f -n -q $vci -s /usr/share/udhcpc/default.script -i $nwif 2>/dev/null + if grep "ip=" /tmp/ipstuff >/dev/null 2>&1 ; then + . /tmp/ipstuff + for i in $dns ; do + echo "nameserver $i" >> /etc/resolv.conf + done + return + else + if [ $i -eq 1 ] ; then + sleep 1 + else + echo "Did not get any proper IP configuration"; /bin/ash + fi + fi +done +} ############################################################################# # device files get their own filesystem (to be move mounted later) @@ -130,15 +149,7 @@ BOOT_IMAGE\nset >/tmp/ipstuff" >/usr/share/udhcpc/default.script chmod u+x /usr/share/udhcpc/default.script modprobe -q af_packet [ -n $vci ] && vci="-V $vci" -udhcpc -t 5 -q $vci -s /usr/share/udhcpc/default.script -i $nwif 2>/dev/null -if grep "ip=" /tmp/ipstuff >/dev/null 2>&1 ; then - . /tmp/ipstuff - for i in $dns ; do - echo "nameserver $i" >> /etc/resolv.conf - done -else - echo "Did not get any proper IP configuration"; /bin/ash -fi +fetchip ip addr add $ip/$(ipcalc -s -p $ip $subnet|sed s/.*=//) dev $nwif ip route add default via $router |