summaryrefslogtreecommitdiffstats
path: root/application/modules/bootloader/views/scripts/env/prebootInit.sh
blob: acf8f33ceef30ecca48d3c8e288eb5cc9c3387f4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
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