diff options
author | Sebastian Schmelzer | 2009-06-18 20:06:52 +0200 |
---|---|---|
committer | Sebastian Schmelzer | 2009-06-18 20:06:52 +0200 |
commit | d64b0b37d63d36b1c01613f31466856ed14f80c7 (patch) | |
tree | a5faba3c9242f38cc57869796e87f8f024181a5e /boot-env | |
parent | Updated the syslinux components to HPAs new version (3.82) ... (diff) | |
download | core-d64b0b37d63d36b1c01613f31466856ed14f80c7.tar.gz core-d64b0b37d63d36b1c01613f31466856ed14f80c7.tar.xz core-d64b0b37d63d36b1c01613f31466856ed14f80c7.zip |
Makefile: remove tabs
new preboot test version
git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@2974 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'boot-env')
-rw-r--r-- | boot-env/OpenSLX/BootEnvironment/Preboot.pm | 1 | ||||
-rw-r--r-- | boot-env/preboot/conf/apache-openslx-preboot.conf | 12 | ||||
-rwxr-xr-x | boot-env/preboot/http-server/users.pl | 90 | ||||
-rw-r--r-- | boot-env/preboot/preboot-scripts/dialog.functions | 24 | ||||
-rwxr-xr-x | boot-env/preboot/preboot.sh | 13 |
5 files changed, 137 insertions, 3 deletions
diff --git a/boot-env/OpenSLX/BootEnvironment/Preboot.pm b/boot-env/OpenSLX/BootEnvironment/Preboot.pm index 888e32ba..b06de7d2 100644 --- a/boot-env/OpenSLX/BootEnvironment/Preboot.pm +++ b/boot-env/OpenSLX/BootEnvironment/Preboot.pm @@ -119,6 +119,7 @@ sub writeBootloaderMenuFor my $prebootBasePath = "$openslxConfig{'base-path'}/share/boot-env/preboot"; slxsystem(qq{cp $prebootBasePath/preboot.sh $bootloaderConfigPath/}); + slxsystem(qq{cp -r $prebootBasePath/preboot-scripts $bootloaderConfigPath/}); slxsystem(qq{chmod a+x $bootloaderConfigPath/preboot.sh}); # create a tar which can/will be downloaded by prebooting clients diff --git a/boot-env/preboot/conf/apache-openslx-preboot.conf b/boot-env/preboot/conf/apache-openslx-preboot.conf index ed7c5082..4eb58809 100644 --- a/boot-env/preboot/conf/apache-openslx-preboot.conf +++ b/boot-env/preboot/conf/apache-openslx-preboot.conf @@ -1,6 +1,14 @@ ScriptAlias /openslx-preboot/cgi-bin/ "/opt/openslx/share/boot-env/preboot/http-server/" + + Alias "/openslx-preboot/users/" "/srv/openslx/preboot-users/" + <Directory "/srv/openslx/preboot-users/"> + Options -Indexes -ExecCGI FollowSymLinks MultiViews + AllowOverride None + Order allow,deny + allow from all + </Directory> + Alias /openslx-preboot/ "/srv/openslx/preboot/" - <Directory "/srv/openslx/preboot/"> Options -Indexes -ExecCGI FollowSymLinks MultiViews AllowOverride None @@ -13,4 +21,4 @@ Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Order allow,deny Allow from all - </Directory>
\ No newline at end of file + </Directory> diff --git a/boot-env/preboot/http-server/users.pl b/boot-env/preboot/http-server/users.pl new file mode 100755 index 00000000..cde3d227 --- /dev/null +++ b/boot-env/preboot/http-server/users.pl @@ -0,0 +1,90 @@ +#!/usr/bin/perl -w +# 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 feedback to feedback@openslx.org +# +# General information about OpenSLX can be found at http://openslx.org +# +# cgi-bin script that accepts user settings and stores them in a special +# folder on the openslx server + +use strict; +use warnings; + +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use File::Path; +use Switch; + +# add openslx stuff to @INC +use FindBin; +use lib "$FindBin::RealBin/../../../../lib"; +use lib "$FindBin::RealBin"; + +# read default config +use OpenSLX::Basics; +openslxInit(); + +my $cgi = CGI->new; +my $mac = $cgi->param('user') || ''; +my $action = $cgi->param('action'); +my $data = $cgi->param('data'); + +# global requirements +die "must give 'mac' ($mac)!\n" + unless $mac; + +my $webPath = "$openslxConfig{'public-path'}/preboot-users"; +my $userConfFile = "$webPath/$mac.conf"; + +# makes only sense if public path is writeable for www-data +# otherwise you have to create directory manualy +if ( ! -e $webPath ) { + mkpath ($webPath) or die _tr("Can't create user config directory (%s). Reason: %s", $webPath, @_); +} + +my $output = ""; +my $error; + +switch ($action) { + case 'set' { + if ($data) { + open (MYFILE, ">$userConfFile"); + print MYFILE $data; + close (MYFILE); + } else { + $error = "no data"; + } + } + case 'read' { + if ( -e $userConfFile ) { + open (MYFILE, $userConfFile); + while (<MYFILE>) { + chomp; + $output .= "$_\n"; + } + close (MYFILE); + } else { + $error = "foobar"; + } + + } + else { + #default case check if we have a user config + if ( -e $userConfFile ) { $output = "1"; } + else { $output = "0"; }; + } +} + +print $cgi->header('Content-type: text/plain'); +if ($error) { + print $error; +} else { + print $output; +} + +exit 0; diff --git a/boot-env/preboot/preboot-scripts/dialog.functions b/boot-env/preboot/preboot-scripts/dialog.functions index a9e76bdd..7c6dd784 100644 --- a/boot-env/preboot/preboot-scripts/dialog.functions +++ b/boot-env/preboot/preboot-scripts/dialog.functions @@ -79,3 +79,27 @@ ddownload () { echo 100 | dialog --gauge "$dl_title" $DIALOG_HEIGHT $DIALOG_WIDTH; } + + + +menu_firststart () { + while [ "x$(cat result)" = "x" ] ; do + dialog --menu "OpenSLX" 30 60 22 \ + 01 "Kiosk" \ + 02 "Kiosk Setup" \ + 03 "Custom System" \ + 2>result + done +} + +menu_oldconfig () { + oldconf=$1; + while [ "x$(cat result)" = "x" ] ; do + dialog --menu "OpenSLX" 30 60 22 \ + 01 "Kiosk" \ + 02 "Kiosk Setup" \ + 03 "Custom System" \ + 04 "Custom System" + 2>result + done +} diff --git a/boot-env/preboot/preboot.sh b/boot-env/preboot/preboot.sh index 169111ed..703af974 100755 --- a/boot-env/preboot/preboot.sh +++ b/boot-env/preboot/preboot.sh @@ -14,13 +14,24 @@ # get configuration . /etc/initramfs-setup +. ./preboot-scripts/dialog.functions # bring the mac address into the standard format 01-<MAC> client=$(echo 01-$macaddr|sed "s/:/-/g") # check if already a configuration is available to decide if user interaction # is required (path is to be fixed) -wget -q -O /tmp/cfg-error $boot_uri/genconfig/${client} +wget -q -O /tmp/have-user-config "$boot_uri/users.pl?user=${client}" +have_user_config=$(cat /tmp/have-user-config); + +if [ "x1" == "x$have_user_config" ]; then + wget -q -O /tmp/oldconfig "$boot_uri/users.pl?user=${client}&action=read" + . /tmp/oldconfig + menu_oldconfig $oldconfig +else + menu_firststart +fi +rm result; # Switch here for several boot TYPE=fastboot/directkiosk/cfgkiosk/slxconfig # fastboot - no interaction use system from client config |