summaryrefslogtreecommitdiffstats
path: root/initramfs/cdboot
diff options
context:
space:
mode:
Diffstat (limited to 'initramfs/cdboot')
-rwxr-xr-xinitramfs/cdboot/init26
-rwxr-xr-xinitramfs/cdboot/mkcdboot.uclib2
2 files changed, 4 insertions, 24 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
diff --git a/initramfs/cdboot/mkcdboot.uclib b/initramfs/cdboot/mkcdboot.uclib
index 6f33bb19..2ae16809 100755
--- a/initramfs/cdboot/mkcdboot.uclib
+++ b/initramfs/cdboot/mkcdboot.uclib
@@ -26,7 +26,7 @@ cp ${SLX_SHARE_PATH}/cdboot/init ${BUILDDIR}/init
cp ${SLX_SHARE_PATH}/busybox/busybox.uclib.i586 ${BUILDDIR}/bin/busybox
for bbins in [ ar arping ash bunzip2 cat chmod chown chroot cp cpio cut \
date dd df dmesg du echo env expr fdisk free grep gunzip hwclock \
- insmod id ip kill killall ln ls lsmod mdev mkdir \
+ insmod id ip ipcalc kill killall ln ls lsmod mdev mkdir \
mknod mkswap modprobe mount mv nice ping printf ps rdate \
rm rmmod sed sleep sort swapoff swapon switch_root tar test tftp \
time touch tr udhcpc umount uptime usleep vconfig vi wget zcat zcip; do