From 416ab8a37f1b07dc9f6c0fb3ff1a8ff2036510b5 Mon Sep 17 00:00:00 2001 From: Sebastian Schmelzer Date: Thu, 2 Sep 2010 17:50:49 +0200 Subject: change dir structure --- .../init-hooks/10-nw-if-config/wlanboot.sh | 75 ++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100755 src/os-plugins/plugins/wlanboot/init-hooks/10-nw-if-config/wlanboot.sh (limited to 'src/os-plugins/plugins/wlanboot/init-hooks') diff --git a/src/os-plugins/plugins/wlanboot/init-hooks/10-nw-if-config/wlanboot.sh b/src/os-plugins/plugins/wlanboot/init-hooks/10-nw-if-config/wlanboot.sh new file mode 100755 index 00000000..fee893d4 --- /dev/null +++ b/src/os-plugins/plugins/wlanboot/init-hooks/10-nw-if-config/wlanboot.sh @@ -0,0 +1,75 @@ +# Copyright (c) 2009 - OpenSLX GmbH +# +# This program/file is free software distributed under the GPL version 2. +# See http://openslx.org/COPYING +# +# If you have any feedback please consult http://openslx.org/feedback and +# send your feedback to feedback@openslx.org +# +# General information about OpenSLX can be found at http://openslx.org +# +# stage3 init-hook 10 of 'wlanboot' plugin - firing up the wlan connection + +#setting udhcpc up +mkdir -p /usr/share/udhcpc +echo -e "#!/bin/ash\nunset infomsg HOME IFS mask lease interface DEBUGLEVEL \ +BOOT_IMAGE\nset >/tmp/ipstuff" >/usr/share/udhcpc/default.script +chmod u+x /usr/share/udhcpc/default.script + +echo "! shutting down watchdog for debugging"; +killall watchdog; + +essid=$(sed -n 's/.*essid=\([^[:blank:]]*\) .*/\1/p' /proc/cmdline); +[ $DEBUGLEVEL -gt 0 ] && echo "set essid to ${essid}"; +#value of essid unchecked yet + + +# load network adaptor modules +#modprobe iwl3945 +cd /lib/modules/$(ls /lib/modules/)/kernel/drivers/net/wireless +for mod in $(find . | grep .ko | sed 's,.*/\([^/]*\).ko,\1',); do + echo "Mod:"; + echo $mod; + modprobe $mod || echo "module $mod did not load for some reason" + usleep 10000 +done +cd / + +wlanif=$(iwconfig 2>/dev/null|sed -n "/ESSID:/p"|sed "s/ .*//") +[ $DEBUGLEVEL -gt 0 ] && echo "wlancard recognized as ${wlanif}"; + +if [ -n "$wlanif" ] ; then + ip link set dev ${wlanif} up + if iwconfig ${wlanif} mode managed essid "${essid}"; then + nwif=${wlanif} + else + error " Unable to configure the WLAN interface." + fi + + + ( sleep 6 ; killall udhcpc >/dev/null 2>&1 ) & + 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 + # simply add a single dns server for passing via kernel cmdline to stage3 + # (quickhack, just the last, list of dns might be better ...) + echo "dnssrv=$i" >>/tmp/ipstuff + return + else + if [ $i -eq 1 ] ; then + sleep 1 + else + echo "Did not get any proper IP configuration"; /bin/ash + fi + fi + + ip addr add $ip/$(ipcalc -s -p $ip $subnet|sed s/.*=//) dev $nwif + ip route add default via $router + [ $DEBUGLEVEL -gt 0 ] && echo "IP-Configuration: $ip on interface $wlanif." +else + error " No wireless LAN capable interface found. Did you provide the \ +proper kernel\n modules and firmware?" +fi \ No newline at end of file -- cgit v1.2.3-55-g7522