From 16a2d28ae58b089ca730f3b7ad407dadd528dcbc Mon Sep 17 00:00:00 2001 From: Daniel Hansson Date: Wed, 7 Feb 2018 21:16:35 +0100 Subject: [PATCH] Revert "smaller fixes (#460)" (#461) This reverts commit fbb5454cb24849edbe45124562086272403b43b3. --- apps/collabora.sh | 37 ++++++++++++++++++++++--------------- apps/onlyoffice.sh | 36 ++++++++++++++++++++++-------------- lib.sh | 2 +- 3 files changed, 45 insertions(+), 30 deletions(-) diff --git a/apps/collabora.sh b/apps/collabora.sh index d117f048..a3486338 100644 --- a/apps/collabora.sh +++ b/apps/collabora.sh @@ -14,7 +14,11 @@ DEBUG=0 debug_mode # Check if root -root_check +if ! is_root +then + printf "\n${Red}Sorry, you are not root.\n${Color_Off}You must type: ${Cyan}sudo ${Color_Off}bash $SCRIPTS/collabora.sh\n" + exit 1 +fi # Test RAM size (2GB min) + CPUs (min 2) ram_check 2 Collabora @@ -23,13 +27,13 @@ cpu_check 2 Collabora # Check if Onlyoffice is running if [ -d "$NCPATH"/apps/onlyoffice ] then -msg_box "It seems like OnlyOffice is running. -You can't run OnlyOffice at the same time as you run Collabora." + echo "It seems like OnlyOffice is running." + echo "You can't run OnlyOffice at the same time as you run Collabora." exit 1 fi # Notification -msg_box "Before you start, please make sure that port 443 is directly forwarded to this machine!" +whiptail --msgbox "Please before you start, make sure that port 443 is directly forwarded to this machine!" "$WT_HEIGHT" "$WT_WIDTH" # Get the latest packages apt update -q4 & spinner_loading @@ -38,15 +42,17 @@ apt update -q4 & spinner_loading echo "Checking if Nextcloud is installed..." if ! curl -s https://"${NCDOMAIN//\\/}"/status.php | grep -q 'installed":true' then -msg_box "It seems like Nextcloud is not installed or that you don't use https on: -${NCDOMAIN//\\/}. -Please install Nextcloud and make sure your domain is reachable, or activate SSL -on your domain to be able to run this script. - -If you use the Nextcloud VM you can use the Let's Encrypt script to get SSL and activate your Nextcloud domain. -When SSL is activated, run these commands from your terminal: -sudo wget $APP/collabora.sh -sudo bash collabora.sh" + echo + echo "It seems like Nextcloud is not installed or that you don't use https on:" + echo "${NCDOMAIN//\\/}." + echo "Please install Nextcloud and make sure your domain is reachable, or activate SSL" + echo "on your domain to be able to run this script." + echo + echo "If you use the Nextcloud VM you can use the Let's Encrypt script to get SSL and activate your Nextcloud domain." + echo "When SSL is activated, run these commands from your terminal:" + echo "sudo wget $APP/collabora.sh" + echo "sudo bash collabora.sh" + any_key "Press any key to continue... " exit 1 fi @@ -62,8 +68,9 @@ elif curl -s -k -m 10 "$SUBDOMAIN"; then elif curl -s -k -m 10 "https://$SUBDOMAIN" -o /dev/null; then sleep 0.1 else -msg_box "Nope, it's not there. You have to create $SUBDOMAIN and point -it to this server before you can run this script." + echo "Nope, it's not there. You have to create $SUBDOMAIN and point" + echo "it to this server before you can run this script." + any_key "Press any key to continue... " exit 1 fi diff --git a/apps/onlyoffice.sh b/apps/onlyoffice.sh index 1ce540e9..de92fa4f 100644 --- a/apps/onlyoffice.sh +++ b/apps/onlyoffice.sh @@ -14,7 +14,11 @@ DEBUG=0 debug_mode # Check if root -root_check +if ! is_root +then + printf "\n${Red}Sorry, you are not root.\n${Color_Off}You must type: ${Cyan}sudo ${Color_Off}bash $SCRIPTS/onlyoffice.sh\n" + exit 1 +fi # Test RAM size (4GB min) + CPUs (min 2) ram_check 4 OnlyOffice @@ -23,13 +27,13 @@ cpu_check 2 OnlyOffice # Check if Collabora is running if [ -d "$NCPATH"/apps/richdocuments ] then -msg_box "It seems like Collabora is running. -You can't run Collabora at the same time as you run OnlyOffice." + echo "It seems like Collabora is running." + echo "You can't run Collabora at the same time as you run OnlyOffice." exit 1 fi # Notification -msg_box "Before you start, please make sure that port 443 is directly forwarded to this machine!" +whiptail --msgbox "Please before you start, make sure that port 443 is directly forwarded to this machine!" "$WT_HEIGHT" "$WT_WIDTH" # Get the latest packages apt update -q4 & spinner_loading @@ -38,14 +42,17 @@ apt update -q4 & spinner_loading echo "Checking if Nextcloud is installed..." if ! curl -s https://"${NCDOMAIN//\\/}"/status.php | grep -q 'installed":true' then -msg_box "It seems like Nextcloud is not installed or that you don't use https on: -${NCDOMAIN//\\/}. -Please install Nextcloud and make sure your domain is reachable, or activate SSL -on your domain to be able to run this script. -If you use the Nextcloud VM you can use the Let's Encrypt script to get SSL and activate your Nextcloud domain. -When SSL is activated, run these commands from your terminal: -sudo wget $APP/onlyoffice.sh -sudo bash onlyoffice.sh" + echo + echo "It seems like Nextcloud is not installed or that you don't use https on:" + echo "${NCDOMAIN//\\/}." + echo "Please install Nextcloud and make sure your domain is reachable, or activate SSL" + echo "on your domain to be able to run this script." + echo + echo "If you use the Nextcloud VM you can use the Let's Encrypt script to get SSL and activate your Nextcloud domain." + echo "When SSL is activated, run these commands from your terminal:" + echo "sudo wget $APP/onlyoffice.sh" + echo "sudo bash onlyoffice.sh" + any_key "Press any key to continue... " exit 1 fi @@ -61,8 +68,9 @@ elif curl -s -k -m 10 "$SUBDOMAIN"; then elif curl -s -k -m 10 "https://$SUBDOMAIN" -o /dev/null; then sleep 0.1 else -msg_box "Nope, it's not there. You have to create $SUBDOMAIN and point -it to this server before you can run this script." + echo "Nope, it's not there. You have to create $SUBDOMAIN and point" + echo "it to this server before you can run this script." + any_key "Press any key to continue... " exit 1 fi diff --git a/lib.sh b/lib.sh index 564cd27b..0e7698fa 100644 --- a/lib.sh +++ b/lib.sh @@ -39,7 +39,7 @@ ISSUES="https://github.com/nextcloud/vm/issues" # User information NCPASS=nextcloud NCUSER=ncadmin -UNIXUSER="$(getent group sudo | cut -d: -f4 | cut -d, -f1)" +UNIXUSER=$SUDO_USER UNIXUSER_PROFILE="/home/$UNIXUSER/.bash_profile" ROOT_PROFILE="/root/.bash_profile" # MARIADB