From 1e40faff2eec15b2ebc255c3079ba714c2aec82f Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Wed, 9 Mar 2022 14:02:53 +0100 Subject: [SSUS] Add warning about Debian 9 support ending soon --- satellit_upgrader/updater.template.sh | 40 ++++++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/satellit_upgrader/updater.template.sh b/satellit_upgrader/updater.template.sh index 22893de..1471e99 100644 --- a/satellit_upgrader/updater.template.sh +++ b/satellit_upgrader/updater.template.sh @@ -14,6 +14,17 @@ if [ "$(lsb_release -si)" != "Debian" ]; then exit 1 fi +IGNORE_ERRORS= +DO_UPDATE= +FORCE= +while [ $# -gt 0 ]; do + [ "$1" = "--ignore-errors" ] && IGNORE_ERRORS=jup + [ "$1" = "--update" ] && DO_UPDATE=pwarning + [ "$1" = "--force" ] && FORCE=true + shift +done +readonly IGNORE_ERRORS + CODENAME="$( lsb_release -sc )" MAJOR="$( lsb_release -sr )" MAJOR="${MAJOR%%.*}" @@ -40,19 +51,24 @@ if (( MAJOR > 11 )); then echo "This Version of the bwLehrpool Satellite Server is too new!" exit 1 fi +if (( MAJOR == 9 )); then + echo "This server is still running Debian ${MAJOR}. Debian ${MAJOR} will not receive any" + echo "security patches after 2022-06-20. It is strongly recommended to upgrade" + echo "to Debian 11 before installing this bwLehrpool server update," + echo "either by doing a dist-upgrade, or by backing up the configuration and" + echo "importing it into a freshly installed server." + if [ -z "$FORCE" ]; then + echo "" + echo "If you still want to apply this update for now, add the '--force' command" + echo "line option, i.e. $0 --update --force" + exit 1 + fi + sleep 2 +fi unset TMPDIR [ -n "$TMPDIR" ] && exit 1 -IGNORE_ERRORS= -DO_UPDATE= -while [ $# -gt 0 ]; do - [ "x$1" = "x--ignore-errors" ] && IGNORE_ERRORS=jup - [ "x$1" = "x--update" ] && DO_UPDATE=pwarning - shift -done -readonly IGNORE_ERRORS - declare -rg SELFPID=$$ perror () { if [ -n "$IGNORE_ERRORS" ]; then @@ -225,21 +241,25 @@ daemon_reload= # Get current webif version if [ -n "$TGZ_SLXADMIN" ]; then declare -rg CURRENT_WEBIF_VERSION="$( < "${PATH_SLXADMIN}/version" tail -n 1 )" + # Print state of affairs echo "bwLehrpool Satellite Server Update" echo -n "Currently installed version: " sed -r 's/([0-9]{4})([0-9]{3})([0-9]{2})/\1-\2-\3/' <<<"$CURRENT_WEBIF_VERSION" echo -n "This update package: " sed -r 's/([0-9]{4})([0-9]{3})([0-9]{2})/\1-\2-\3/' <<<"$TARGET_WEBIF_VERSION" + # Now if this appears to be a downgrade wait 5 seconds... if [ -z "$CURRENT_WEBIF_VERSION" ] || [ "$TARGET_WEBIF_VERSION" = "missing" ] || [ "$CURRENT_WEBIF_VERSION" -le "$TARGET_WEBIF_VERSION" ]; then : # Negate so NaN triggers else branch else - ${DO_UPDATE:-perror} "This update seems to be older than the server version you're currently running" + pwarning "This update seems to be older than the version you're currently running." + [ -z "${DO_UPDATE}" ] && perror "Pass --update to install anyways." echo -n "Press Ctrl+C to cancel update..." for i in 5 4 3 2 1; do sleep 1 echo -n "${i}.." done fi + # Make sure --update was passed if [ -z "$DO_UPDATE" ]; then echo "If you want to install this update, run again with --update parameter:" echo "eg. sh $0 --update" -- cgit v1.2.3-55-g7522