summaryrefslogtreecommitdiffstats
path: root/application/modules/bootloader/views/scripts/env/prebootInit.sh
diff options
context:
space:
mode:
Diffstat (limited to 'application/modules/bootloader/views/scripts/env/prebootInit.sh')
-rw-r--r--application/modules/bootloader/views/scripts/env/prebootInit.sh71
1 files changed, 71 insertions, 0 deletions
diff --git a/application/modules/bootloader/views/scripts/env/prebootInit.sh b/application/modules/bootloader/views/scripts/env/prebootInit.sh
new file mode 100644
index 0000000..acf8f33
--- /dev/null
+++ b/application/modules/bootloader/views/scripts/env/prebootInit.sh
@@ -0,0 +1,71 @@
+#!/bin/ash
+# 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
+#
+# preboot script for user interaction with OpenSLX preloading environment for
+# Linux stateless clients (fetched by Preboot init over the net)
+
+# get configuration
+. /etc/initramfs-setup
+. /etc/pbs.conf
+. ./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/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
+# directkiosk - start the default slx system into kiosk (using vmchooser)
+# cfgkiosk - offer the user changes to his kiosk system (GUI environment)
+# slxconfig - offer the user set of configuration options, like setting a non-
+# priviledged user, root password, standard gui, plugins to activate ...
+
+wget -q -O /preboot/bootmenu.dialog ${boot_uri}bootloader/env/getmenu/formedia/$pbs_id
+
+# we expect to have a system selection dialog file in /preboot/bootmenu.dialog
+chmod u+x /preboot/bootmenu.dialog
+/preboot/bootmenu.dialog
+
+. /tmp/boot
+
+
+# fetch kernel and initramfs of selected system
+dialog --infobox "Loading kernel of ${systemname} ..." 3 65
+#ddownload ${boot_uri}bootloader/env/getkernel/forsystem/$systemid "Kernel" /tmp/kernel
+wget -q -O /tmp/kernel ${boot_uri}bootloader/env/getkernel/forsystem/$systemid
+dialog --infobox "Loading initial ramfs of ${systemname} ..." 3 65
+#ddownload ${boot_uri}bootloader/env/getinitramfs/forsystem/$systemid "Initramfs" /tmp/initramfs
+wget -q -O /tmp/initramfs ${boot_uri}bootloader/env/getinitramfs/forsystem/$systemid
+
+# read primary IP configuration to pass it on (behaviour like IPAPPEND=1 of
+# PXElinux)
+. /tmp/ipstuff
+
+[ "x$DEBUGLEVEL" != x0 ] && { clear; ash; }
+
+# start the new kernel with initialramfs and composed cmdline
+dialog --infobox "Booting OpenSLX client $label ... (be patient this could take some time)" 3 69
+kexec -l /tmp/kernel --initrd=/tmp/initramfs \
+ --append="$append file=http://${syssource}/pbs/client-config/${sysname}/pbs.tgz $quiet ip=$ip:$siaddr:$router:$subnet:$dnssrv $debug" 2>/dev/null
+kexec -e >/dev/null 2>&1