diff options
Diffstat (limited to 'initramfs/cdboot/init')
-rwxr-xr-x | initramfs/cdboot/init | 26 |
1 files changed, 3 insertions, 23 deletions
diff --git a/initramfs/cdboot/init b/initramfs/cdboot/init index dd0af295..499768f9 100755 --- a/initramfs/cdboot/init +++ b/initramfs/cdboot/init @@ -12,27 +12,7 @@ # Main script for cd-boot demo initial ramfs - preloading environment for # for running OpenSLX linux stateless clients version 4 for testing -############################################################################# -# helper function: compute prefix bit number from netmask -# fixme: replace with ipcalc -p $ip $netmask -nm2pref () { -set $(IFS="."; echo $1) -local n=0 -local i - for i in $1 $2 $3 $4 ; do - case $i in - 0) break ;; - 128) n=$(($n + 1)) ; break ;; - 192) n=$(($n + 2)) ; break ;; - 224) n=$(($n + 3)) ; break ;; - 240) n=$(($n + 4)) ; break ;; - 252) n=$(($n + 6)) ; break ;; - 254) n=$(($n + 7)) ; break ;; - 255) n=$(($n + 8)) ; continue ;; - esac - done -echo $n -} + ############################################################################# # device files get their own filesystem (to be move mounted later) @@ -150,7 +130,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 -n -q $vci -s /usr/share/udhcpc/default.script -i $nwif 2>/dev/null +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 @@ -159,7 +139,7 @@ if grep "ip=" /tmp/ipstuff >/dev/null 2>&1 ; then else echo "Did not get any proper IP configuration"; /bin/ash fi -ip addr add $ip/$(nm2pref $subnet) dev $nwif +ip addr add $ip/$(ipcalc -s -p $ip $subnet|sed s/.*=//) dev $nwif ip route add default via $router # at this point a little selection script could be downloaded, which lets the |