summaryrefslogtreecommitdiffstats
path: root/os-plugins/plugins/wlanboot
diff options
context:
space:
mode:
authorAlexander Hoppe2009-06-03 11:11:44 +0200
committerAlexander Hoppe2009-06-03 11:11:44 +0200
commit823a272149b7b71c096fc64c700654b7068185ea (patch)
treeb097101f9c39d64c8aa5bb177f12589187dc4081 /os-plugins/plugins/wlanboot
parentChanges to PreBoot as discussed (removing selection part from isolinux (diff)
downloadcore-823a272149b7b71c096fc64c700654b7068185ea.tar.gz
core-823a272149b7b71c096fc64c700654b7068185ea.tar.xz
core-823a272149b7b71c096fc64c700654b7068185ea.zip
state for wlanboot-plugin
git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@2913 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'os-plugins/plugins/wlanboot')
-rw-r--r--os-plugins/plugins/wlanboot/OpenSLX/OSPlugin/wlanboot.pm31
-rwxr-xr-xos-plugins/plugins/wlanboot/init-hooks/10-nw-if-config/wlanboot.sh64
2 files changed, 83 insertions, 12 deletions
diff --git a/os-plugins/plugins/wlanboot/OpenSLX/OSPlugin/wlanboot.pm b/os-plugins/plugins/wlanboot/OpenSLX/OSPlugin/wlanboot.pm
index 533be865..ab1c614e 100644
--- a/os-plugins/plugins/wlanboot/OpenSLX/OSPlugin/wlanboot.pm
+++ b/os-plugins/plugins/wlanboot/OpenSLX/OSPlugin/wlanboot.pm
@@ -20,6 +20,8 @@ use base qw(OpenSLX::OSPlugin::Base);
use File::Path;
+use Data::Dumper;
+
use OpenSLX::Basics;
use OpenSLX::Utils;
@@ -71,6 +73,16 @@ sub getAttrInfo
content_descr => '1 means active - 0 means inactive',
default => '1',
},
+ 'wlanboot::activenics' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ kernel modules to load ..
+ End-of-Here
+ content_regex => '',
+ content_descr => 'space seperated list of kernel modules (without .ko)',
+ default => 'iwl3945 arc4 ecb',
+ },
};
}
@@ -86,6 +98,7 @@ sub installationPhase
my $attrs = $info->{'plugin-attrs'};
my $filesDir = "$openslxBasePath/lib/plugins/wlanboot/files";
+ slxsystem("cp -r $filesDir $pluginRepoPath/");
return;
}
@@ -101,6 +114,21 @@ sub removalPhase
return;
}
+sub suggestAdditionalKernelModules
+{
+ my $self = shift;
+ my $info = shift;
+
+ my $attrs = $info->{'attrs'};
+
+ my @suggestedKernelModules;
+
+ print Dumper(split(/ /, $attrs->{'wlanboot::activenics'}));
+ push(@suggestedKernelModules, split(/ /, $attrs->{'wlanboot::activenics'} ));
+
+ return @suggestedKernelModules;
+}
+
sub copyRequiredFilesIntoInitramfs
{
my $self = shift;
@@ -115,6 +143,9 @@ sub copyRequiredFilesIntoInitramfs
$makeInitRamFSEngine->addCMD(
"cp -a $pluginRepoPath/files/firmware $targetPath/lib"
);
+ $makeInitRamFSEngine->addCMD(
+ "cp -a $pluginRepoPath/files/lib $targetPath/"
+ );
vlog(1, _tr("wlanboot-plugin: ..."));
return;
diff --git a/os-plugins/plugins/wlanboot/init-hooks/10-nw-if-config/wlanboot.sh b/os-plugins/plugins/wlanboot/init-hooks/10-nw-if-config/wlanboot.sh
index 2608ace1..fee893d4 100755
--- a/os-plugins/plugins/wlanboot/init-hooks/10-nw-if-config/wlanboot.sh
+++ b/os-plugins/plugins/wlanboot/init-hooks/10-nw-if-config/wlanboot.sh
@@ -10,26 +10,66 @@
#
# stage3 init-hook 10 of 'wlanboot' plugin - firing up the wlan connection
-# get essid for WLAN boot
-for source in /proc/cmdline /etc/initramfs-setup ; do
- essid=$(grep essid $source)
- if [ -n "$essid" ] ; then
- essid=${essid#essid=}
- break
- fi
+#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
-# do WLAN specific settings, definition of wlan interface name and wireless
-# connect
+cd /
+
wlanif=$(iwconfig 2>/dev/null|sed -n "/ESSID:/p"|sed "s/ .*//")
-if [ -n "$if" ] ; then
+[ $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
-
+fi \ No newline at end of file