From 9c6045378e1dc27dafa6cef7eaee371913f2fbaf Mon Sep 17 00:00:00 2001 From: szaimen Date: Tue, 23 Feb 2021 20:27:17 +0100 Subject: [PATCH] move extract to its own script (#1849) Signed-off-by: szaimen --- apps/extract.sh | 57 +++++++++++++++++++++++++++++++++ menu/additional_apps.sh | 5 +++ not-supported/restore-backup.sh | 2 +- 3 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 apps/extract.sh diff --git a/apps/extract.sh b/apps/extract.sh new file mode 100644 index 00000000..05756fc1 --- /dev/null +++ b/apps/extract.sh @@ -0,0 +1,57 @@ +#!/bin/bash + +# T&M Hansson IT AB © - 2021, https://www.hanssonit.se/ +# Copyright © 2021 Simon Lindner (https://github.com/szaimen) + +true +SCRIPT_NAME="Extract for Nextcloud" +SCRIPT_EXPLAINER="$SCRIPT_NAME enables archive extraction inside your Nextcloud." +# shellcheck source=lib.sh +source /var/scripts/fetch_lib.sh || source <(curl -sL https://raw.githubusercontent.com/nextcloud/vm/master/lib.sh) + +# Check for errors + debug code and abort if something isn't right +# 1 = ON +# 0 = OFF +DEBUG=0 +debug_mode + +# Check if root +root_check + +# Check if extract is already installed +if ! is_app_installed extract +then + # Ask for installing + install_popup "$SCRIPT_NAME" +else + # Ask for removal or reinstallation + reinstall_remove_menu "$SCRIPT_NAME" + # Removal + nextcloud_occ app:remove extract + for packet in unrar p7zip "p7zip-full" + do + if is_this_installed "$packet" + then + apt purge "$packet" -y + fi + done + apt autoremove -y + # Show successful uninstall if applicable + removal_popup "$SCRIPT_NAME" +fi + +# Install packages for extract +install_if_not unrar +install_if_not p7zip +install_if_not p7zip-full + +# Install extract +install_and_enable_app extract + +# Check if it was installed +if is_app_enabled extract +then + msg_box "$SCRIPT_NAME was successfully installed!" +else + msg_box "The installation wasn't successful. Please try again by running this script again!" +fi diff --git a/menu/additional_apps.sh b/menu/additional_apps.sh index bdec5d63..569d1b88 100644 --- a/menu/additional_apps.sh +++ b/menu/additional_apps.sh @@ -43,6 +43,7 @@ $CHECKLIST_GUIDE\n\n$RUN_LATER_GUIDE" "$WT_HEIGHT" "$WT_WIDTH" 4 \ "Fail2ban " "(Extra Bruteforce protection)" "$STARTUP_SWITCH" \ "Adminer" "(PostgreSQL GUI)" OFF \ "ClamAV" "(Antivirus for Nextcloud and files)" OFF \ +"Extract" "(Archive extraction for Nextcloud)" OFF \ "Netdata" "(Real-time server monitoring in Web GUI)" OFF \ "BPYTOP" "(Real-time server monitoring in CLI)" OFF \ "Midnight Commander" "(CLI file manager)" OFF \ @@ -75,6 +76,10 @@ case "$choice" in print_text_in_color "$ICyan" "Downloading the ClamAV script..." run_script APP clamav ;;& + *"Extract"*) + print_text_in_color "$ICyan" "Downloading the Extract script..." + run_script APP extract + ;;& *"Netdata"*) print_text_in_color "$ICyan" "Downloading the Netdata script..." run_script APP netdata diff --git a/not-supported/restore-backup.sh b/not-supported/restore-backup.sh index 6ad07ccd..d6203426 100644 --- a/not-supported/restore-backup.sh +++ b/not-supported/restore-backup.sh @@ -602,7 +602,7 @@ msg_box "Restore completed!\n You can now simply reinstall all apps and addons that were installed on your server before!\n Those need to get installed (if they were installed on the old server before): Geoblocking, Disk Monitoring, Fail2Ban, ClamAV, SMTP Mail, DDclient, Activate TLS, OnlyOffice, Push Notifications for Nextcloud, \ -High-Performance backend for Talk, Bitwarden RS, Pi-hole, PiVPN, Plex Media Server, Remotedesktop and Midnight Commander.\n +High-Performance backend for Nextcloud Talk, Extract for Nextcloud, Bitwarden RS, Pi-hole, PiVPN, Plex Media Server, Remotedesktop and Midnight Commander.\n Note: Bitwarden RS and Plex Media Server files were restored (if they were installed before) but the containers need to get \ installed again to make them run with the restored files."