diff options
author | szaimen <szaimen@e.mail.de> | 2020-05-13 22:14:55 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-13 22:14:55 +0300 |
commit | c7d5807659ae3b1125f8129ed5b3cd85a7ae7d46 (patch) | |
tree | 37a5732c85386c7ecacf0ee2c1dbc344d38f3779 | |
parent | 5b0103e58a615077124a4a122ef3fd7fefd9d5b3 (diff) |
Main menu (#1228)
Co-authored-by: Daniel Hansson <github@hanssonit.se>
-rw-r--r-- | apps/additional_apps.sh | 2 | ||||
-rw-r--r-- | apps/smbmount.sh | 3 | ||||
-rw-r--r-- | nextcloud-startup-script.sh | 4 | ||||
-rw-r--r-- | static/change-root-profile.sh | 4 | ||||
-rw-r--r-- | static/main_menu.sh | 54 | ||||
-rw-r--r-- | static/menu.sh | 28 | ||||
-rw-r--r-- | static/nextcloud_configuration.sh | 2 | ||||
-rw-r--r-- | static/server_configuration.sh | 2 |
8 files changed, 93 insertions, 6 deletions
diff --git a/apps/additional_apps.sh b/apps/additional_apps.sh index d2e4801f..342d358f 100644 --- a/apps/additional_apps.sh +++ b/apps/additional_apps.sh @@ -17,7 +17,7 @@ debug_mode root_check # Install Apps -choice=$(whiptail --title "Which apps do you want to install?" --checklist "Automatically configure and install selected apps\nSelect by pressing the spacebar" "$WT_HEIGHT" "$WT_WIDTH" 4 \ +choice=$(whiptail --title "Which apps do you want to install?" --checklist "Automatically configure and install selected apps\nSelect by pressing the spacebar\nYou can view this menu later by running 'sudo bash $SCRIPTS/menu.sh'" "$WT_HEIGHT" "$WT_WIDTH" 4 \ "Fail2ban" "(Extra Bruteforce protection)" OFF \ "Adminer" "(PostgreSQL GUI)" OFF \ "Netdata" "(Real-time server monitoring)" OFF \ diff --git a/apps/smbmount.sh b/apps/smbmount.sh index 27dd61e2..17666760 100644 --- a/apps/smbmount.sh +++ b/apps/smbmount.sh @@ -22,6 +22,9 @@ SMBSHARES="/mnt/smbshares" SMBSHARES_SED=${SMBSHARES//\//\\/} SMB_CREDENTIALS="/root/.smbcredentials" +# Install whiptail if not existing +install_if_not whiptail + # Check MAX_COUNT if ! [ $MAX_COUNT -gt 0 ] then diff --git a/nextcloud-startup-script.sh b/nextcloud-startup-script.sh index 64aa2f56..281b64f5 100644 --- a/nextcloud-startup-script.sh +++ b/nextcloud-startup-script.sh @@ -246,6 +246,7 @@ download_static_script update-config download_static_script apps download_static_script configuration download_le_script activate-tls +download_static_script menu if home_sme_server then download_static_script nhss_index @@ -457,6 +458,9 @@ rm -f "$SCRIPTS/instruction.sh" rm -f "$NCDATA/nextcloud.log" rm -f "$SCRIPTS/static_ip.sh" rm -f "$SCRIPTS/lib.sh" +rm -f "$SCRIPTS/configuration.sh" +rm -f "$SCRIPTS/apps.sh" +rm -f "$SCRIPTS/server_configuration.sh" find /root "/home/$UNIXUSER" -type f \( -name '*.sh*' -o -name '*.html*' -o -name '*.tar*' -o -name 'results' -o -name '*.zip*' \) -delete find "$NCPATH" -type f \( -name 'results' -o -name '*.sh*' \) -delete diff --git a/static/change-root-profile.sh b/static/change-root-profile.sh index 397cd4df..d495deba 100644 --- a/static/change-root-profile.sh +++ b/static/change-root-profile.sh @@ -45,8 +45,6 @@ ROOT-PROFILE { echo "alias nextcloud_occ='sudo -u www-data php $NCPATH/occ'" echo "alias update_nextcloud='bash $SCRIPTS/update.sh'" -echo "alias additional_apps='bash $SCRIPTS/apps.sh'" -echo "alias nextcloud_configuration='bash $SCRIPTS/configuration.sh'" -echo "alias server_configuration='bash $SCRIPTS/server_configuration.sh'" +echo "alias main_menu='bash $SCRIPTS/menu.sh'" } > /root/.bash_aliases diff --git a/static/main_menu.sh b/static/main_menu.sh new file mode 100644 index 00000000..154dab75 --- /dev/null +++ b/static/main_menu.sh @@ -0,0 +1,54 @@ +#!/bin/bash + +# T&M Hansson IT AB © - 2020, https://www.hanssonit.se/ + +# shellcheck disable=2034,2059 +true +# shellcheck source=lib.sh +. <(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 + +# Must be root +root_check + +# Main menu +choice=$(whiptail --title "Main Menu" --radiolist "Choose what you want to do.\nSelect by pressing the spacebar and ENTER\nYou can view this menu later by running 'sudo bash $SCRIPTS/menu.sh" "$WT_HEIGHT" "$WT_WIDTH" 4 \ +"Additional Apps" "(Choose which apps to install)" OFF \ +"Nextcloud Configuration" "(Choose between available Nextcloud configurations)" OFF \ +"Server Configuration" "(Choose between available server configurations)" OFF \ +"Update Nextcloud" "(Update Nextcloud to the latest release)" OFF 3>&1 1>&2 2>&3) + +case "$choice" in + "Additional Apps") + if network_ok + then + run_static_script additional_apps + fi + ;; + "Nextcloud Configuration") + if network_ok + then + run_static_script nextcloud_configuration + fi + ;; + "Server Configuration") + if network_ok + then + run_static_script server_configuration + fi + ;; + "Update Nextcloud") + if network_ok + then + run_static_script update + fi + ;; + *) + ;; +esac +exit diff --git a/static/menu.sh b/static/menu.sh new file mode 100644 index 00000000..bc6fb3e7 --- /dev/null +++ b/static/menu.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +# T&M Hansson IT AB © - 2020, https://www.hanssonit.se/ + +# shellcheck disable=2034,2059 +true +# shellcheck source=lib.sh +. <(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 + +# Must be root +root_check + +mkdir -p "$SCRIPTS" +print_text_in_color "$ICyan" "Running the main menu script..." + +if network_ok +then + # Delete, download, run + run_static_script main_menu +fi + +exit diff --git a/static/nextcloud_configuration.sh b/static/nextcloud_configuration.sh index 374fe945..06b779bf 100644 --- a/static/nextcloud_configuration.sh +++ b/static/nextcloud_configuration.sh @@ -18,7 +18,7 @@ debug_mode root_check # Configure Nextcloud -choice=$(whiptail --title "Nextcloud Configuration" --checklist "Which settings do you want to configure?\nSelect by pressing the spacebar" "$WT_HEIGHT" "$WT_WIDTH" 4 \ +choice=$(whiptail --title "Nextcloud Configuration" --checklist "Which settings do you want to configure?\nSelect by pressing the spacebar\nYou can view this menu later by running 'sudo bash $SCRIPTS/menu.sh'" "$WT_HEIGHT" "$WT_WIDTH" 4 \ "CookieLifetime" "(Configure forced logout timeout for users using the web GUI)" OFF \ "Share-folder" "(Shares from other users will appear in a folder named 'Shared')" OFF \ "Disable workspaces" "(disable top notes in GUI)" OFF \ diff --git a/static/server_configuration.sh b/static/server_configuration.sh index 3a4a4586..1e79f6d5 100644 --- a/static/server_configuration.sh +++ b/static/server_configuration.sh @@ -32,7 +32,7 @@ debug_mode root_check # Server configurations -choice=$(whiptail --title "Server configurations" --checklist "Choose what you want to configure\nSelect by pressing the spacebar" "$WT_HEIGHT" "$WT_WIDTH" 4 \ +choice=$(whiptail --title "Server configurations" --checklist "Choose what you want to configure\nSelect by pressing the spacebar\nYou can view this menu later by running 'sudo bash $SCRIPTS/menu.sh'" "$WT_HEIGHT" "$WT_WIDTH" 4 \ "Activate TLS" "(Enable HTTPS with Let's Encrypt)" ON \ "Security" "(Add extra security based on this http://goo.gl/gEJHi7)" OFF \ "Static IP" "(Set static IP in Ubuntu with netplan.io)" OFF \ |