From b49d7cb9de04a8ec042bca6fde08170fa2898d4a Mon Sep 17 00:00:00 2001 From: enoch85 Date: Wed, 29 Jun 2016 20:36:22 +0200 Subject: [PATCH] ask user if the security script should be applied --- nextcloud-startup-script.sh | 31 +++++++++++++++++++++++++++++++ nextcloud_install_production.sh | 5 ----- 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/nextcloud-startup-script.sh b/nextcloud-startup-script.sh index c0c6422a..9036fd7e 100644 --- a/nextcloud-startup-script.sh +++ b/nextcloud-startup-script.sh @@ -24,6 +24,7 @@ UNIXPASS=nextcloud exit 1 fi +echo "Setting correct interface..." # Set correct interface { sed '/# The primary network interface/q' /etc/network/interfaces; printf 'auto %s\niface %s inet dhcp\n# This is an autoconfigured IPv6 interface\niface %s inet6 auto\n' "$IFACE" "$IFACE" "$IFACE"; } > /etc/network/interfaces.new mv /etc/network/interfaces.new /etc/network/interfaces @@ -47,6 +48,15 @@ ADDRESS=$(hostname -I | cut -d ' ' -f 1) echo "Getting scripts from GitHub to be able to run the first setup..." + # Get security script + if [ -f $SCRIPTS/security.sh ]; + then + rm $SCRIPTS/security.sh + wget -q $STATIC/security.sh -P $SCRIPTS + else + wget -q $STATIC/security.sh -P $SCRIPTS +fi + # Get the latest nextcloud_update.sh if [ -f $SCRIPTS/update.sh ]; then @@ -252,6 +262,27 @@ bash $SCRIPTS/phpmyadmin_install_ubuntu16.sh rm $SCRIPTS/phpmyadmin_install_ubuntu16.sh clear +# Add extra security +function ask_yes_or_no() { + read -p "$1 ([y]es or [N]o): " + case $(echo $REPLY | tr '[A-Z]' '[a-z]') in + y|yes) echo "yes" ;; + *) echo "no" ;; + esac +} +if [[ "yes" == $(ask_yes_or_no "Do you want to add extra security, based on this: http://goo.gl/gEJHi7 ?") ]] +then + bash $SCRIPTS/security.sh + rm $SCRIPTS/security.sh +else +echo + echo "OK, but if you want to run it later, just type: sudo bash $SCRIPTS/security.sh" + echo -e "\e[32m" + read -p "Press any key to continue... " -n1 -s + echo -e "\e[0m" +fi + + # Set keyboard layout echo "Current keyboard layout is Swedish" echo "You must change keyboard layout to your language" diff --git a/nextcloud_install_production.sh b/nextcloud_install_production.sh index bd266393..dd67e497 100644 --- a/nextcloud_install_production.sh +++ b/nextcloud_install_production.sh @@ -426,11 +426,6 @@ wget -q http://www.webmin.com/jcameron-key.asc -O- | sudo apt-key add - apt-get update -q2 apt-get install webmin -y -# Add extra security -wget -q $STATIC/security.sh -P $SCRIPTS -bash $SCRIPTS/security.sh -rm $SCRIPTS/security.sh - # Download and install Documents #if [ -d $NCPATH/apps/documents ]; then #sleep 1