From 36432522d7ab8444bbd9bc22bb0cc3da8564896d Mon Sep 17 00:00:00 2001 From: szaimen Date: Sat, 12 Dec 2020 21:02:17 +0100 Subject: [PATCH] allow to install not-latest nextcloud versions (#1714) * allow to install not-latest nextcloud versions Signed-off-by: szaimen * fix detail Signed-off-by: szaimen * fix formatting Signed-off-by: szaimen * improve readability Signed-off-by: szaimen --- menu/main_menu.sh | 16 ++++++++++++++-- nextcloud-startup-script.sh | 2 +- nextcloud_install_production.sh | 18 ++++++++++++++++++ 3 files changed, 33 insertions(+), 3 deletions(-) diff --git a/menu/main_menu.sh b/menu/main_menu.sh index 97ef3802..b71f3b55 100644 --- a/menu/main_menu.sh +++ b/menu/main_menu.sh @@ -26,7 +26,8 @@ $MENU_GUIDE\n\n$RUN_LATER_GUIDE" "$WT_HEIGHT" "$WT_WIDTH" 4 \ "Nextcloud Configuration" "(Choose between available Nextcloud configurations)" \ "Startup Configuration" "(Choose between available startup configurations)" \ "Server Configuration" "(Choose between available server configurations)" \ -"Update Nextcloud" "(Update Nextcloud to the latest release)" 3>&1 1>&2 2>&3) +"Update Nextcloud major" "(Update Nextcloud to the latest major release)" \ +"Update Nextcloud minor" "(Update Nextcloud to the latest minor release)" 3>&1 1>&2 2>&3) case "$choice" in "Additional Apps") @@ -45,7 +46,7 @@ case "$choice" in print_text_in_color "$ICyan" "Downloading the Server Configuration Menu..." run_script MENU server_configuration ;; - "Update Nextcloud") + "Update Nextcloud major") if [ -f "$SCRIPTS"/update.sh ] then bash "$SCRIPTS"/update.sh @@ -56,6 +57,17 @@ case "$choice" in bash "$SCRIPTS"/update.sh fi ;; + "Update Nextcloud minor") + if [ -f "$SCRIPTS"/update.sh ] + then + bash "$SCRIPTS"/update.sh minor + else + print_text_in_color "$ICyan" "Downloading the Update script..." + download_script STATIC update + chmod +x "$SCRIPTS"/update.sh + bash "$SCRIPTS"/update.sh minor + fi + ;; *) ;; esac diff --git a/nextcloud-startup-script.sh b/nextcloud-startup-script.sh index 5db7015c..38d68be1 100644 --- a/nextcloud-startup-script.sh +++ b/nextcloud-startup-script.sh @@ -538,7 +538,7 @@ ROOTNEWPROFILE # Upgrade system print_text_in_color "$ICyan" "System will now upgrade..." -bash $SCRIPTS/update.sh +bash $SCRIPTS/update.sh minor # Cleanup 2 apt autoremove -y diff --git a/nextcloud_install_production.sh b/nextcloud_install_production.sh index bae648b7..b6c2e894 100644 --- a/nextcloud_install_production.sh +++ b/nextcloud_install_production.sh @@ -31,6 +31,11 @@ then print_text_in_color "$ICyan" "Running in provisioning mode..." export PROVISIONING=1 sleep 1 +elif [ "$1" = "--not-latest" ] +then + NOT_LATEST=1 + print_text_in_color "$ICyan" "Running in not-latest mode..." + sleep 1 else msg_box "Failed to get the correct flag. Did you enter it correctly?" exit 1 @@ -431,6 +436,19 @@ calculate_php_fpm # Install VM-tools install_if_not open-vm-tools +# Get not-latest Nextcloud version +if [ -n "$NOT_LATEST" ] +then + while [ -z "$NCVERSION" ] + do + print_text_in_color "$ICyan" "Fetching the not-latest Nextcloud version..." + NCVERSION=$(curl -s -m 900 $NCREPO/ | sed --silent 's/.*href="nextcloud-\([^"]\+\).zip.asc".*/\1/p' \ +| sort --version-sort | grep -v "\.0$\|\.1$\|\.2$" | tail -1) + STABLEVERSION="nextcloud-$NCVERSION" + print_text_in_color "$IGreen" "$NCVERSION" + done +fi + # Download and validate Nextcloud package check_command download_verify_nextcloud_stable