summaryrefslogtreecommitdiffstats
path: root/satellit_upgrader/updater.template.sh
diff options
context:
space:
mode:
authorSimon Rettberg2016-07-05 17:44:39 +0200
committerSimon Rettberg2016-07-05 17:44:39 +0200
commitc98979078ae1c872664e35d8b3c8de0fb959537e (patch)
treeb086961eda7cd71524599d2e7325fcc0fa279501 /satellit_upgrader/updater.template.sh
parent[SSUS] Include lighttpd.conf from installer (diff)
downloadsetup-scripts-c98979078ae1c872664e35d8b3c8de0fb959537e.tar.gz
setup-scripts-c98979078ae1c872664e35d8b3c8de0fb959537e.tar.xz
setup-scripts-c98979078ae1c872664e35d8b3c8de0fb959537e.zip
[SSUS] Various minor fixes/improvements
Diffstat (limited to 'satellit_upgrader/updater.template.sh')
-rw-r--r--satellit_upgrader/updater.template.sh65
1 files changed, 46 insertions, 19 deletions
diff --git a/satellit_upgrader/updater.template.sh b/satellit_upgrader/updater.template.sh
index 69658fd..d4c7e5f 100644
--- a/satellit_upgrader/updater.template.sh
+++ b/satellit_upgrader/updater.template.sh
@@ -131,6 +131,23 @@ declare -rg FILEDIR="$TMPDIR/files"
# **********************************************************
+# ********************** Taskmanager ***********************
+# Do this first in case one of the later updates depends on the taskmanager
+if [ -n "$TGZ_TASKMANAGER" ]; then
+ [ -e "$TMPDIR/$TGZ_TASKMANAGER" ] || perror "$TGZ_TASKMANAGER missing from payload"
+ echo "* Task manager"
+ echo "Extracting new jar and data"
+ # Replacement trick (see slxadmin)
+ tar -x -C "$PATH_TASKMANAGER" -f "$TMPDIR/$TGZ_TASKMANAGER" || perror "Could not extract $TGZ_TASKMANAGER to $PATH_TASKMANAGER"
+ rm -rf -- "$PATH_TASKMANAGER/data" "$PATH_TASKMANAGER/scripts" "$PATH_TASKMANAGER/plugins" "$PATH_TASKMANAGER/taskmanager.sh"
+ tar -x -C "$PATH_TASKMANAGER" -f "$TMPDIR/$TGZ_TASKMANAGER"
+ fixperms "$PATH_TASKMANAGER" root:root
+ chmod -R a+x "$PATH_TASKMANAGER/scripts"
+ echo "Restarting service"
+ restart_service taskmanager
+ echo "Taskmanager upgrade complete"
+fi
+
# ************************** IPXE **************************
if [ -n "$TGZ_IPXE" ]; then
[ -e "$TMPDIR/$TGZ_IPXE" ] || perror "$TGZ_IPXE missing from payload"
@@ -145,7 +162,7 @@ if [ -n "$TGZ_IPXE" ]; then
echo "iPXE upgrade complete"
# Trigger default compile in the background so the next regen doesn't take too long
{
- cd "$PATH_IPXE/src" && sudo -u taskmanager nice -n 10 make bin/undionly.kkkpxe > /dev/null 2>&1
+ cd "$PATH_IPXE/src" && sudo -n -u taskmanager nice -n 10 make -j2 bin/undionly.kkkpxe > /dev/null 2>&1
} &
fi
@@ -158,7 +175,7 @@ if [ -n "$TGZ_SLXADMIN" ]; then
tar tf "$TMPDIR/$TGZ_SLXADMIN" >/dev/null 2>&1 || perror "Could not extract $TGZ_SLXADMIN to $PATH_SLXADMIN"
rm -rf -- "$PATH_SLXADMIN/"{inc,apis,modules,templates,Mustache,script,style}
tar -x -C "$PATH_SLXADMIN" -f "$TMPDIR/$TGZ_SLXADMIN"
- rm -- "$PATH_SLXADMIN/config.php.example"
+ rm -f -- "$PATH_SLXADMIN/config.php.example"
# Enable modules
(
mkdir -p "$PATH_SLXADMIN/modules"
@@ -169,6 +186,7 @@ if [ -n "$TGZ_SLXADMIN" ]; then
ln -s "../modules-available/$mod" "$name" || pwarning "Could not activate module '$mod' (alias '$name')"
done
# Update DB
+ cd "$PATH_SLXADMIN"
if ! ./install-all > "$TMPDIR/wwwup.log"; then
cat "$TMPDIR/wwwup.log"
perror "Updating the web interface database failed"
@@ -177,7 +195,8 @@ if [ -n "$TGZ_SLXADMIN" ]; then
cat "$TMPDIR/wwwup.log"
perror "Updating the web interface database failed"
fi
- if [ "x$(tail -n -1 "$TMPDIR/wwwup.log")" != "Done." ]; then
+ if [ "x$(tail -n -1 "$TMPDIR/wwwup.log")" != "xDone." ]; then
+ cat "$TMPDIR/wwwup.log"
pwarning "slxadmin updater didn't finish with 'Done.'"
fi
)
@@ -203,6 +222,17 @@ if [ -n "$TGZ_SLXADMIN" ]; then
fixperms "$PATH_SLXADMIN" root:root
chmod 0640 "$PATH_SLXADMIN/config.php"
chown root:www-data "$PATH_SLXADMIN/config.php"
+ # Update version number in DB - doesn't make too much sense like this, restore would overwrite
+ mysql -e "INSERT INTO openslx.property (name, value) VALUES ('webif-version', '${TARGET_WEBIF_VERSION}')
+ ON DUPLICATE KEY UPDATE value = VALUES(value)" || pwarning "Could not update version number in DB"
+ # config.tgz symlink -> db entry
+ if [ -L /srv/openslx/www/boot/default/config.tgz ]; then
+ CONFTGZ=$(readlink /srv/openslx/www/boot/default/config.tgz | sed "s/'/\\\'/g")
+ echo "config.tgz links to '$CONFTGZ'"
+ mysql -e "INSERT IGNORE INTO openslx.configtgz_location (locationid, configid) SELECT 0, configid FROM openslx.configtgz WHERE filepath = '$CONFTGZ' LIMIT 1" \
+ || pwarning "Could not convert default config.tgz setting - do so manually"
+ rm -f -- /srv/openslx/www/boot/default/config.tgz
+ fi
ln -s -f "$PATH_TFTP" "/srv/openslx/www/tftp" || perror "Could not symlink $PATH_TFTP to /srv/openslx/www/tftp"
echo "Web interface upgrade complete"
fi
@@ -229,22 +259,6 @@ if [ -n "$TGZ_DOZMOD" ]; then
echo "Dozentenmodul Server Daemon upgrade complete"
fi
-# ********************** Taskmanager ***********************
-if [ -n "$TGZ_TASKMANAGER" ]; then
- [ -e "$TMPDIR/$TGZ_TASKMANAGER" ] || perror "$TGZ_TASKMANAGER missing from payload"
- echo "* Task manager"
- echo "Extracting new jar and data"
- # Replacement trick (see slxadmin)
- tar -x -C "$PATH_TASKMANAGER" -f "$TMPDIR/$TGZ_TASKMANAGER" || perror "Could not extract $TGZ_TASKMANAGER to $PATH_TASKMANAGER"
- rm -rf -- "$PATH_TASKMANAGER/data" "$PATH_TASKMANAGER/scripts" "$PATH_TASKMANAGER/plugins" "$PATH_TASKMANAGER/taskmanager.sh"
- tar -x -C "$PATH_TASKMANAGER" -f "$TMPDIR/$TGZ_TASKMANAGER"
- fixperms "$PATH_TASKMANAGER" root:root
- chmod -R a+x "$PATH_TASKMANAGER/scripts"
- echo "Restarting service"
- restart_service taskmanager
- echo "Taskmanager upgrade complete"
-fi
-
# ************************** TFTP **************************
if [ -n "$TGZ_TFTP" ]; then
[ -e "$TMPDIR/$TGZ_TFTP" ] || perror "$TGZ_TFTP missing from payload"
@@ -308,6 +322,19 @@ if [ -n "$TGZ_LDADP" ]; then
echo "LDADP upgrade complete"
fi
+# ************************ sudo config *********************
+if [ -n "$FILEDIR/tm-sudo-config" ]; then
+ cp -f "$FILEDIR/tm-sudo-config" "/etc/sudoers.d/taskmanager" || pwarning "Could not update sudo conf for taskmanager"
+ chmod 0440 "/etc/sudoers.d/taskmanager"
+fi
+
+for i in 1 1 1 1 2 2 3 4 END; do
+ CB=$(sudo -u www-data -n php /srv/openslx/www/slx-admin/api.php cb)
+ [ "x$CB" != "xTrue" ] && break
+ [ "$i" = "END" ] && break
+ sleep $i
+done
+
echo ""
echo "Update complete. It is recommended to reboot the server."
echo ""