From aa6626925eff26751e156bf392256298dad07a34 Mon Sep 17 00:00:00 2001 From: Dirk von Suchodoletz Date: Tue, 13 Jan 2009 19:31:08 +0000 Subject: Adding a new plugin "wlanboot". Just first checkin - untested ... git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@2474 95ad53e4-c205-0410-b2fa-d234c58c8868 --- .../plugins/wlanboot/OpenSLX/OSPlugin/wlanboot.pm | 118 +++++++++++++++++++++ os-plugins/plugins/wlanboot/XX_wlanboot.sh | 23 ++++ os-plugins/plugins/wlanboot/files/bin/iwconfig | Bin 0 -> 17640 bytes os-plugins/plugins/wlanboot/files/bin/iwevent | Bin 0 -> 13540 bytes os-plugins/plugins/wlanboot/files/bin/iwgetid | Bin 0 -> 9344 bytes os-plugins/plugins/wlanboot/files/bin/iwlist | Bin 0 -> 25884 bytes os-plugins/plugins/wlanboot/files/bin/iwpriv | Bin 0 -> 9384 bytes os-plugins/plugins/wlanboot/files/bin/iwspy | Bin 0 -> 9372 bytes os-plugins/plugins/wlanboot/files/bin/iwtest | 1 + os-plugins/plugins/wlanboot/files/firmware/README | 8 ++ .../init-hooks/10-nw-if-config/wlanboot.sh | 36 +++++++ os-plugins/plugins/x11vnc/XX_x11vnc.sh | 4 +- 12 files changed, 188 insertions(+), 2 deletions(-) create mode 100644 os-plugins/plugins/wlanboot/OpenSLX/OSPlugin/wlanboot.pm create mode 100644 os-plugins/plugins/wlanboot/XX_wlanboot.sh create mode 100755 os-plugins/plugins/wlanboot/files/bin/iwconfig create mode 100755 os-plugins/plugins/wlanboot/files/bin/iwevent create mode 100755 os-plugins/plugins/wlanboot/files/bin/iwgetid create mode 100755 os-plugins/plugins/wlanboot/files/bin/iwlist create mode 100755 os-plugins/plugins/wlanboot/files/bin/iwpriv create mode 100755 os-plugins/plugins/wlanboot/files/bin/iwspy create mode 100644 os-plugins/plugins/wlanboot/files/bin/iwtest create mode 100644 os-plugins/plugins/wlanboot/files/firmware/README create mode 100755 os-plugins/plugins/wlanboot/init-hooks/10-nw-if-config/wlanboot.sh diff --git a/os-plugins/plugins/wlanboot/OpenSLX/OSPlugin/wlanboot.pm b/os-plugins/plugins/wlanboot/OpenSLX/OSPlugin/wlanboot.pm new file mode 100644 index 00000000..441254b3 --- /dev/null +++ b/os-plugins/plugins/wlanboot/OpenSLX/OSPlugin/wlanboot.pm @@ -0,0 +1,118 @@ +# Copyright (c) 2009 - OpenSLX GmbH +# +# This program 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 suggestions, praise, or complaints to feedback@openslx.org +# +# General information about OpenSLX can be found at http://openslx.org/ +# ----------------------------------------------------------------------------- +# wlanboot.pm +# - an wlanboot extension to the stage3 system +# ----------------------------------------------------------------------------- +package OpenSLX::OSPlugin::wlanboot; + +use strict; +use warnings; + +use base qw(OpenSLX::OSPlugin::Base); + +use OpenSLX::Basics; +use OpenSLX::Utils; + +################################################################################ +# if you have any questions regarding the concept of OS-plugins and their +# implementation, please drop a mail to: ot@openslx.com, or join the IRC-channel +# '#openslx' (on freenode). +################################################################################ +sub new +{ + my $class = shift; + + my $self = { + name => 'wlanboot', + }; + + return bless $self, $class; +} + +sub getInfo +{ + my $self = shift; + + return { + description => unshiftHereDoc(<<' End-of-Here'), + wlanboot is an extension for stage 3 + End-of-Here + precedence => 50, + }; +} + +sub getAttrInfo +{ # returns a hash-ref with information about all attributes supported + # by this specific plugin + my $self = shift; + + # This default configuration will be added as attributes to the default + # system, such that it can be overruled for any specific system by means + # of slxconfig. + return { + # attribute 'active' is mandatory for all plugins + 'wlanboot::active' => { + applies_to_systems => 1, + applies_to_clients => 0, + description => unshiftHereDoc(<<' End-of-Here'), + should the 'wlanboot'-plugin be executed during boot? + End-of-Here + content_regex => qr{^(0|1)$}, + content_descr => '1 means active - 0 means inactive', + default => '1', + }, + }; +} + +sub installationPhase +{ + my $self = shift; + my $info = shift; + + my $pluginRepoPath = $info->{'plugin-repo-path'}; + my $pluginTempPath = $info->{'plugin-temp-path'}; + my $openslxBasePath = $info->{'openslx-base-path'}; + my $openslxConfigPath = $info->{'openslx-config-path'}; + my $attrs = $info->{'plugin-attrs'}; + + my $filesDir = "$openslxBasePath/lib/plugins/wlanboot/files"; + + return; +} + +sub removalPhase +{ + my $self = shift; + my $info = shift; + + my $pluginRepoPath = $info->{'plugin-repo-path'}; + my $pluginTempPath = $info->{'plugin-temp-path'}; + + return; +} + +sub copyRequiredFilesIntoInitramfs +{ + my $self = shift; + my $targetPath = shift; + my $attrs = shift; + my $makeInitRamFSEngine = shift; + my $pluginRepoPath = $info->{'plugin-repo-path'}; + + $makeInitRamFSEngine->addCMD( + "cp -p $pluginRepoPath/files/bin/* $targetPath/bin/" + ); + $makeInitRamFSEngine->addCMD( + "cp -a $pluginRepoPath/files/firmware $targetPath/lib" + ); +} + +1; diff --git a/os-plugins/plugins/wlanboot/XX_wlanboot.sh b/os-plugins/plugins/wlanboot/XX_wlanboot.sh new file mode 100644 index 00000000..d8ede9c7 --- /dev/null +++ b/os-plugins/plugins/wlanboot/XX_wlanboot.sh @@ -0,0 +1,23 @@ +# 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 part of 'wlanboot' plugin - the runlevel script +# +# script is included from init via the "." load function - thus it has all +# variables and functions available + +if [ -e /initramfs/plugin-conf/wlanboot.conf ]; then + . /initramfs/plugin-conf/wlanboot.conf + if [ $wlanboot_active -ne 0 ]; then + [ $DEBUGLEVEL -gt 0 ] && echo "executing the 'wlanboot' os-plugin ..."; + [ $DEBUGLEVEL -gt 0 ] && echo "done with 'wlanboot' os-plugin ..."; + + fi +fi diff --git a/os-plugins/plugins/wlanboot/files/bin/iwconfig b/os-plugins/plugins/wlanboot/files/bin/iwconfig new file mode 100755 index 00000000..ebe4b5af Binary files /dev/null and b/os-plugins/plugins/wlanboot/files/bin/iwconfig differ diff --git a/os-plugins/plugins/wlanboot/files/bin/iwevent b/os-plugins/plugins/wlanboot/files/bin/iwevent new file mode 100755 index 00000000..20b6293a Binary files /dev/null and b/os-plugins/plugins/wlanboot/files/bin/iwevent differ diff --git a/os-plugins/plugins/wlanboot/files/bin/iwgetid b/os-plugins/plugins/wlanboot/files/bin/iwgetid new file mode 100755 index 00000000..6a51e3f9 Binary files /dev/null and b/os-plugins/plugins/wlanboot/files/bin/iwgetid differ diff --git a/os-plugins/plugins/wlanboot/files/bin/iwlist b/os-plugins/plugins/wlanboot/files/bin/iwlist new file mode 100755 index 00000000..de811e46 Binary files /dev/null and b/os-plugins/plugins/wlanboot/files/bin/iwlist differ diff --git a/os-plugins/plugins/wlanboot/files/bin/iwpriv b/os-plugins/plugins/wlanboot/files/bin/iwpriv new file mode 100755 index 00000000..73f711db Binary files /dev/null and b/os-plugins/plugins/wlanboot/files/bin/iwpriv differ diff --git a/os-plugins/plugins/wlanboot/files/bin/iwspy b/os-plugins/plugins/wlanboot/files/bin/iwspy new file mode 100755 index 00000000..48ff6db1 Binary files /dev/null and b/os-plugins/plugins/wlanboot/files/bin/iwspy differ diff --git a/os-plugins/plugins/wlanboot/files/bin/iwtest b/os-plugins/plugins/wlanboot/files/bin/iwtest new file mode 100644 index 00000000..c6846702 --- /dev/null +++ b/os-plugins/plugins/wlanboot/files/bin/iwtest @@ -0,0 +1 @@ +test file for plugin wlanboot. diff --git a/os-plugins/plugins/wlanboot/files/firmware/README b/os-plugins/plugins/wlanboot/files/firmware/README new file mode 100644 index 00000000..0845746d --- /dev/null +++ b/os-plugins/plugins/wlanboot/files/firmware/README @@ -0,0 +1,8 @@ +Put all the required firmwares of WLAN adapters you would like to use in +your setup here into this subdirectory. They are copied into the InitRamFS +to be present for device configuration via modprobe/mdev in stage3. + +For more information on the "wlanboot" plugin have a look at the project +page! + +The OpenSLX Team 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 new file mode 100755 index 00000000..169e567d --- /dev/null +++ b/os-plugins/plugins/wlanboot/init-hooks/10-nw-if-config/wlanboot.sh @@ -0,0 +1,36 @@ +# 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 + +if [ $wlanboot_active -ne 0 ]; then + # 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 + done + # do WLAN specific settings, definition of wlan interface name and wireless + # connect + wlanif=$(iwconfig 2>/dev/null|sed -n "/ESSID:/p"|sed "s/ .*//") + if [ -n "$if" ] ; 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 + else + error " No wireless LAN capable interface found. Did you provide the \ +proper kernel\n modules and firmware?" +fi + diff --git a/os-plugins/plugins/x11vnc/XX_x11vnc.sh b/os-plugins/plugins/x11vnc/XX_x11vnc.sh index 0f076914..3970e468 100644 --- a/os-plugins/plugins/x11vnc/XX_x11vnc.sh +++ b/os-plugins/plugins/x11vnc/XX_x11vnc.sh @@ -1,5 +1,5 @@ -# Copyright (c) 2007..2008 - RZ Uni Freiburg -# Copyright (c) 2008 - OpenSLX GmbH +# Copyright (c) 2007..2009 - RZ Uni Freiburg +# Copyright (c) 2009 - OpenSLX GmbH # # This program/file is free software distributed under the GPL version 2. # See http://openslx.org/COPYING -- cgit v1.2.3-55-g7522