summaryrefslogtreecommitdiffstats
path: root/initramfs/cdboot/init
diff options
context:
space:
mode:
authorDirk von Suchodoletz2008-03-04 20:11:17 +0100
committerDirk von Suchodoletz2008-03-04 20:11:17 +0100
commit88c2acd706d5a1cac28dbbbf91e24defa0e3e5a1 (patch)
treec1127aac3ad7db9d9232de80c12f71752cd340a6 /initramfs/cdboot/init
parentFirst try of "selfcontained" InitRamFS without external glibc. Created (diff)
downloadcore-88c2acd706d5a1cac28dbbbf91e24defa0e3e5a1.tar.gz
core-88c2acd706d5a1cac28dbbbf91e24defa0e3e5a1.tar.xz
core-88c2acd706d5a1cac28dbbbf91e24defa0e3e5a1.zip
Fixes for DNDB2 in SLX init, update of mkcdboot.uclib with ipcalc
applet. git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@1598 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'initramfs/cdboot/init')
-rwxr-xr-xinitramfs/cdboot/init26
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