From 5b2abb395b29422dac28f8cecd98a8d6431f56eb Mon Sep 17 00:00:00 2001 From: szaimen <42591237+szaimen@users.noreply.github.com> Date: Fri, 24 Jan 2020 19:58:26 +0100 Subject: [PATCH] Additional apps.sh (#1051) --- additional_apps.sh | 103 ++++++++++++++++++++++++++++++++++ nextcloud-startup-script.sh | 94 ++----------------------------- static/apps.sh | 27 +++++++++ static/change-root-profile.sh | 1 + 4 files changed, 136 insertions(+), 89 deletions(-) create mode 100644 additional_apps.sh create mode 100644 static/apps.sh diff --git a/additional_apps.sh b/additional_apps.sh new file mode 100644 index 00000000..ad61c06e --- /dev/null +++ b/additional_apps.sh @@ -0,0 +1,103 @@ +#!/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 + +# Install Apps +whiptail --title "Which apps do you want to install?" --checklist --separate-output "Automatically configure and install selected apps\nSelect by pressing the spacebar" "$WT_HEIGHT" "$WT_WIDTH" 4 \ +"Fail2ban" "(Extra Bruteforce protection) " OFF \ +"Adminer" "(PostgreSQL GUI) " OFF \ +"Netdata" "(Real-time server monitoring) " OFF \ +"Collabora" "(Online editing [2GB RAM]) " OFF \ +"OnlyOffice" "(Online editing [2GB RAM]) " OFF \ +"Bitwarden" "(External password manager) " OFF \ +"FullTextSearch" "(Elasticsearch for Nextcloud [2GB RAM]) " OFF \ +"PreviewGenerator" "(Pre-generate previews) " OFF \ +"LDAP" "(Windows Active directory) " OFF \ +"Talk" "(Nextcloud Video calls and chat) " OFF \ +"SMB-mount" "(Connect to SMB-shares from your local network) " OFF 2>results + +while read -r -u 11 choice +do + case $choice in + Fail2ban) + clear + run_app_script fail2ban + ;; + + Adminer) + clear + run_app_script adminer + ;; + + Netdata) + clear + run_app_script netdata + ;; + + OnlyOffice) + clear + run_app_script onlyoffice + ;; + + Collabora) + clear + run_app_script collabora + ;; + + Bitwarden) + clear + run_app_script tmbitwarden + ;; + + FullTextSearch) + clear + run_app_script fulltextsearch + ;; + + PreviewGenerator) + clear + run_app_script previewgenerator + ;; + + LDAP) + clear + print_text_in_color "$ICyan" "Installing LDAP..." + if install_and_enable_app user_ldap + then + msg_box "LDAP installed! Please visit https://subdomain.yourdomain.com/settings/admin/ldap to finish the setup once this script is done." + else msg_box "LDAP installation failed." + fi + ;; + + Talk) + clear + run_app_script talk + ;; + + "SMB-mount") + clear + run_app_script smbmount + ;; + + *) + ;; + esac +done 11< results +rm -f results +clear + +exit diff --git a/nextcloud-startup-script.sh b/nextcloud-startup-script.sh index 039c27c4..31c732af 100644 --- a/nextcloud-startup-script.sh +++ b/nextcloud-startup-script.sh @@ -240,6 +240,7 @@ download_static_script setup_secure_permissions_nextcloud download_static_script change_db_pass download_static_script nextcloud download_static_script update-config +download_static_script apps download_le_script activate-ssl if home_sme_server then @@ -429,89 +430,8 @@ else fi clear -# Install Apps -whiptail --title "Which apps do you want to install?" --checklist --separate-output "Automatically configure and install selected apps\nSelect by pressing the spacebar" "$WT_HEIGHT" "$WT_WIDTH" 4 \ -"Fail2ban" "(Extra Bruteforce protection) " OFF \ -"Adminer" "(PostgreSQL GUI) " OFF \ -"Netdata" "(Real-time server monitoring) " OFF \ -"Collabora" "(Online editing [2GB RAM]) " OFF \ -"OnlyOffice" "(Online editing [2GB RAM]) " OFF \ -"Bitwarden" "(External password manager) " OFF \ -"FullTextSearch" "(Elasticsearch for Nextcloud [2GB RAM]) " OFF \ -"PreviewGenerator" "(Pre-generate previews) " OFF \ -"LDAP" "(Windows Active directory) " OFF \ -"Talk" "(Nextcloud Video calls and chat) " OFF \ -"SMB-mount" "(Connect to SMB-shares from your local network) " OFF 2>results - -while read -r -u 11 choice -do - case $choice in - Fail2ban) - clear - run_app_script fail2ban - ;; - - Adminer) - clear - run_app_script adminer - ;; - - Netdata) - clear - run_app_script netdata - ;; - - OnlyOffice) - clear - run_app_script onlyoffice - ;; - - Collabora) - clear - run_app_script collabora - ;; - - Bitwarden) - clear - run_app_script tmbitwarden - ;; - - FullTextSearch) - clear - run_app_script fulltextsearch - ;; - - PreviewGenerator) - clear - run_app_script previewgenerator - ;; - - LDAP) - clear - print_text_in_color "$ICyan" "Installing LDAP..." - if install_and_enable_app user_ldap - then - msg_box "LDAP installed! Please visit https://subdomain.yourdomain.com/settings/admin/ldap to finish the setup once this script is done." - else msg_box "LDAP installation failed." - fi - ;; - - Talk) - clear - run_app_script talk - ;; - - "SMB-mount") - clear - run_app_script smbmount - ;; - - *) - ;; - esac -done 11< results -rm -f results -clear +# Install apps +bash $SCRIPTS/apps.sh # Change passwords # CLI USER @@ -540,9 +460,11 @@ if [[ "$NCADMIN" ]] then print_text_in_color "$ICyan" "Deleting $NCADMIN..." occ_command user:delete "$NCADMIN" + sleep 2 fi clear +# Add default notifications notify_admin_gui \ "Please setup SMTP" \ "Please remember to setup SMTP to be able to send shared links, user notifications and more via email. Please go here and start setting it up: https://your-nextcloud/settings/admin." @@ -625,12 +547,6 @@ mesg n ROOTNEWPROFILE -# Download all app scripts -print_text_in_color "$ICyan" "Downloading all the latest app scripts to $SCRIPTS/apps..." -mkdir -p $SCRIPTS/apps -cd $SCRIPTS/apps -check_command curl -s https://codeload.github.com/nextcloud/vm/tar.gz/master | tar -xz --strip=2 vm-master/apps - # Upgrade system print_text_in_color "$ICyan" "System will now upgrade..." bash $SCRIPTS/update.sh diff --git a/static/apps.sh b/static/apps.sh new file mode 100644 index 00000000..3ce844ff --- /dev/null +++ b/static/apps.sh @@ -0,0 +1,27 @@ +#!/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" + +if network_ok +then + # Delete, download, run + run_main_script additional_apps +fi + +exit diff --git a/static/change-root-profile.sh b/static/change-root-profile.sh index 4f442fe7..ff9e2544 100644 --- a/static/change-root-profile.sh +++ b/static/change-root-profile.sh @@ -45,5 +45,6 @@ ROOT-PROFILE { echo "alias nextcloud_occ='sudo -u www-data php $NCPATH/occ'" echo "alias run_update_nextcloud='bash $SCRIPTS/update.sh'" +echo "alias additional_apps='bash $SCRIPTS/apps.sh'" } > /root/.bash_aliases