summaryrefslogtreecommitdiffstats
path: root/satellit_upgrader/updater.template.sh
diff options
context:
space:
mode:
Diffstat (limited to 'satellit_upgrader/updater.template.sh')
-rw-r--r--satellit_upgrader/updater.template.sh24
1 files changed, 22 insertions, 2 deletions
diff --git a/satellit_upgrader/updater.template.sh b/satellit_upgrader/updater.template.sh
index b51a0f4..2f34c0c 100644
--- a/satellit_upgrader/updater.template.sh
+++ b/satellit_upgrader/updater.template.sh
@@ -209,6 +209,7 @@ if [ -n "$TGZ_TASKMANAGER" ]; then
tar -x -C "$PATH_TASKMANAGER" -f "$TMPDIR/$TGZ_TASKMANAGER"
fixperms "$PATH_TASKMANAGER" root:root
chmod -R a+x "$PATH_TASKMANAGER/scripts"
+ # Where we place the downloadable iPXE images
mkdir -p -m 0755 "/srv/openslx/www/boot/download"
fixperms "/srv/openslx/www/boot/download" taskmanager:www-data
echo "Restarting service"
@@ -240,7 +241,7 @@ if [ -n "$TGZ_IPXE" ]; then
} &
IPXE_PID=$!
fi
-# Need mtools
+# Need mtools for creating floppy images for iPXE
if ! which mformat &>/dev/null; then
failprint apt-get install -y mtools
fi
@@ -252,6 +253,8 @@ if [ -n "$TGZ_SLXADMIN" ]; then
# Test archive
INCMODS=$(mktemp)
tar tf "$TMPDIR/$TGZ_SLXADMIN" | grep -oP '^modules-available/[^/]+/$' > "$INCMODS" || perror "Could not read $TGZ_SLXADMIN"
+ # Remember boot module if already set
+ bootmodule=$( basename "$( readlink -f "$PATH_SLXADMIN/modules/serversetup" 2> /dev/null )" )
# Remove old files - wipe selectively, just in case someone added a new module by hand
rm -rf -- "$PATH_SLXADMIN/"{inc,apis,modules,templates,Mustache,script,style}
while read -r line || [[ -n "$line" ]]; do
@@ -291,12 +294,29 @@ if [ -n "$TGZ_SLXADMIN" ]; then
diffcp "slxadmin-cronscript" "/opt/openslx/slxadmin-cronscript"
# New crontab supplied
diffcp "slxadmin-crontab" "/etc/cron.d/slx-admin"
+ # Ask about ipxe / pxelinux
+ if [ -z "$bootmodule" ] || ! [ -d "$PATH_SLXADMIN/modules-available/$bootmodule" ]; then
+ bootmodule="serversetup-bwlp-pxelinux"
+ if [ -t 0 ] && [ -t 1 ]; then
+ echo "Congratulations! You have won a bwLehrpool-Server with iPXE support!"
+ echo "Do you want to enable iPXE boot support instead of the old ipxelinux4 approach?"
+ echo -n "If unsure, say NO here. [y/n]: "
+ read answer
+ while ! [[ "$answer" =~ ^[nNyY] ]]; do
+ echo -n "Please answer [Y]es or [N]o: "
+ read answer
+ done
+ [[ "$answer" =~ ^[yY] ]] && bootmodule="serversetup-bwlp-ipxe"
+ else
+ echo "(Not asking about iPXE vs. pxelinux 4 because we're not running from a terminal)"
+ fi
+ fi
# Enable modules
(
mkdir -p "$PATH_SLXADMIN/modules"
cd "$PATH_SLXADMIN/modules" || perror "Cannot cd to slxadmin"
echo "Enabling slx-admin modules"
- for mod in adduser backup baseconfig baseconfig_bwidm baseconfig_bwlp bootstrap_datepicker bootstrap_dialog bootstrap_multiselect bootstrap_switch bootstrap_timepicker dnbd3 dozmod eventlog exams js_chart js_circles js_jqueryui js_moment js_selectize js_stupidtable js_vis js_weekcalendar locationinfo locations main minilinux news permissionmanager rebootcontrol roomplanner runmode serversetup-bwlp session statistics statistics_reporting summernote sysconfig syslog systemstatus vmstore webinterface; do
+ for mod in adduser backup baseconfig baseconfig_bwidm baseconfig_bwlp bootstrap_datepicker bootstrap_dialog bootstrap_multiselect bootstrap_switch bootstrap_timepicker dnbd3 dozmod eventlog exams js_chart js_circles js_jqueryui js_moment js_selectize js_stupidtable js_vis js_weekcalendar locationinfo locations main minilinux news permissionmanager rebootcontrol roomplanner runmode "$bootmodule" session statistics statistics_reporting summernote sysconfig syslog systemstatus vmstore webinterface; do
name=${mod%%-*}
rm -f -- "$name"
ln -s "../modules-available/$mod" "$name" || pwarning "Could not activate module '$mod' (alias '$name')"