From 64bf42f2f3dd18f294d8626aaf412c90760277f0 Mon Sep 17 00:00:00 2001 From: nachoparker Date: Thu, 27 Apr 2017 08:12:51 +0200 Subject: [PATCH] added show_info() to nextcloudpi-config --- bin/nextcloudpi-config | 1 + etc/library.sh | 12 ++++++++++++ etc/nextcloudpi-config.d/NFS.sh | 9 +++++---- etc/nextcloudpi-config.d/letsencrypt.sh | 9 +++++++++ etc/nextcloudpi-config.d/modsecurity.sh | 10 ++++++++++ etc/nextcloudpi-config.d/nc-ramlogs.sh | 10 ++++++++++ etc/nextcloudpi-config.d/nc-scan-auto.sh | 7 +++++-- etc/nextcloudpi-config.d/nc-wifi.sh | 25 +++++++++++++----------- etc/nextcloudpi-config.d/no-ip.sh | 9 +++++++++ etc/nextcloudpi-config.d/samba.sh | 9 +++++---- 10 files changed, 80 insertions(+), 21 deletions(-) diff --git a/bin/nextcloudpi-config b/bin/nextcloudpi-config index 176daf3fe..fc3fda21a 100755 --- a/bin/nextcloudpi-config +++ b/bin/nextcloudpi-config @@ -49,6 +49,7 @@ function nextcloud-config() [[ $? -ne $DIALOG_OK ]] || [[ "$script" == "" ]] && return 0 # launch selected script + info_script $script.sh || return 1; configure_script $script.sh } diff --git a/etc/library.sh b/etc/library.sh index 95948c20e..a3330fce2 100755 --- a/etc/library.sh +++ b/etc/library.sh @@ -215,6 +215,18 @@ function install_script() ) } +function info_script() +{ + ( + local SCRIPT=$1 + cd /usr/local/etc/nextcloudpi-config.d/ + unset show_info + source ./$SCRIPT + [[ $( type -t show_info ) == function ]] || return 0 + [[ $( type -t show_info ) == function ]] && show_info + ) +} + function configure_script() { ( diff --git a/etc/nextcloudpi-config.d/NFS.sh b/etc/nextcloudpi-config.d/NFS.sh index fb55554fc..2e64f407b 100755 --- a/etc/nextcloudpi-config.d/NFS.sh +++ b/etc/nextcloudpi-config.d/NFS.sh @@ -27,11 +27,9 @@ install() systemctl disable nfs-kernel-server } -configure() +show_info() { - # INFO - ################################ - whiptail --msgbox \ + whiptail --yesno \ --backtitle "NextCloudPi configuration" \ --title "Instructions for external synchronization" \ "If we intend to modify the data folder through NFS, @@ -39,7 +37,10 @@ then we have to synchronize NextCloud to make it aware of the changes. \n This can be done manually or automatically using 'nc-scan' and 'nc-scan-auto' from 'nextcloudpi-config'" \ 20 90 +} +configure() +{ # CHECKS ################################ [ -d "$DIR_" ] || { echo -e "INFO: directory $DIR_ does not exist. Creating"; mkdir -p "$DIR_"; } diff --git a/etc/nextcloudpi-config.d/letsencrypt.sh b/etc/nextcloudpi-config.d/letsencrypt.sh index 76583d415..415288e7f 100755 --- a/etc/nextcloudpi-config.d/letsencrypt.sh +++ b/etc/nextcloudpi-config.d/letsencrypt.sh @@ -26,6 +26,15 @@ install() /etc/letsencrypt/letsencrypt-auto --help # do not actually run certbot, only install packages } +show_info() +{ + whiptail --yesno \ + --backtitle "NextCloudPi configuration" \ + --title "Warning" \ +"Internet access is required for this configuration to complete" \ + 20 90 +} + # tested with git version v0.11.0-71-g018a304 configure() { diff --git a/etc/nextcloudpi-config.d/modsecurity.sh b/etc/nextcloudpi-config.d/modsecurity.sh index 37a1b8ea9..ce53f6623 100755 --- a/etc/nextcloudpi-config.d/modsecurity.sh +++ b/etc/nextcloudpi-config.d/modsecurity.sh @@ -88,6 +88,16 @@ EOF EOF } +show_info() +{ + whiptail --yesno \ + --backtitle "NextCloudPi configuration" \ + --title "Experimental feature warning" \ +"This feature is highly experimental and has only been tested with +a basic NextCloud installation. If a new App does not work disable it" \ + 20 90 +} + configure() { [[ $ACTIVE_ == "yes" ]] && local STATE=On || local STATE=Off diff --git a/etc/nextcloudpi-config.d/nc-ramlogs.sh b/etc/nextcloudpi-config.d/nc-ramlogs.sh index 3e75286fc..dc8b8ccc1 100755 --- a/etc/nextcloudpi-config.d/nc-ramlogs.sh +++ b/etc/nextcloudpi-config.d/nc-ramlogs.sh @@ -18,6 +18,16 @@ ACTIVE_=no DESCRIPTION="mount logs in RAM to prevent SD card degradation (faster, consumes more RAM)" +show_info() +{ + whiptail --yesno \ + --backtitle "NextCloudPi configuration" \ + --title "Warning" \ +"If you are installing software other than NextCloud +that creates folders under '/var/log/' disable this feature" \ + 20 90 +} + configure() { [[ $ACTIVE_ != "yes" ]] && { diff --git a/etc/nextcloudpi-config.d/nc-scan-auto.sh b/etc/nextcloudpi-config.d/nc-scan-auto.sh index 0f495959c..285d025f6 100755 --- a/etc/nextcloudpi-config.d/nc-scan-auto.sh +++ b/etc/nextcloudpi-config.d/nc-scan-auto.sh @@ -17,16 +17,19 @@ SCANINTERVAL_=60 DESCRIPTION="Periodically scan NC for externally modified files" -configure() +show_info() { - whiptail --msgbox \ + whiptail --yesno \ --backtitle "NextCloudPi configuration" \ --title "Instructions for auto synchronization" \ "Set the time in minutes in SCANINTERVAL. \n >>> If there are too many files this can greatly affect performance. <<< \n SCANINTERVAL=0 will disable periodic synchronization." \ 20 90 +} +configure() +{ [[ $SCANINTERVAL_ == 0 ]] && { systemctl stop nc-scan.timer systemctl disable nc-scan.timer diff --git a/etc/nextcloudpi-config.d/nc-wifi.sh b/etc/nextcloudpi-config.d/nc-wifi.sh index 0ab9d7edc..f71ada4a2 100755 --- a/etc/nextcloudpi-config.d/nc-wifi.sh +++ b/etc/nextcloudpi-config.d/nc-wifi.sh @@ -24,6 +24,20 @@ install() systemctl disable wicd } +show_info() +{ + whiptail --yesno \ + --backtitle "NextCloudPi configuration" \ + --title "Instructions to configure Wi-Fi" \ +"1) Select a Wi-Fi network +2) Press right arrow -> +3) Enter the passphrase for your Wi-Fi +4) Make sure to select 'connect automatically' +5) F10 to save +6) C to connect" \ + 20 90 +} + configure() { # Installation in QEMU (without a wireless interface) produces @@ -41,17 +55,6 @@ configure() systemctl enable wicd systemctl start wicd - whiptail --msgbox \ - --backtitle "NextCloudPi configuration" \ - --title "Instructions to configure Wi-Fi" \ -"1) Select a Wi-Fi network -2) Press right arrow -> -3) Enter the passphrase for your Wi-Fi -4) Make sure to select 'connect automatically' -5) F10 to save -6) C to connect" \ - 20 90 - wicd-curses } diff --git a/etc/nextcloudpi-config.d/no-ip.sh b/etc/nextcloudpi-config.d/no-ip.sh index afaaf55b2..1183a7c2e 100755 --- a/etc/nextcloudpi-config.d/no-ip.sh +++ b/etc/nextcloudpi-config.d/no-ip.sh @@ -51,6 +51,15 @@ EOF rm -r /tmp/noip } +show_info() +{ + whiptail --yesno \ + --backtitle "NextCloudPi configuration" \ + --title "Warning" \ +"Internet access is required for this configuration to complete" \ + 20 90 +} + configure() { [[ $ACTIVE_ == "no" ]] && { service noip2 stop; update-rc.d noip2 disable; return; } diff --git a/etc/nextcloudpi-config.d/samba.sh b/etc/nextcloudpi-config.d/samba.sh index 0de3bed8f..95e876083 100644 --- a/etc/nextcloudpi-config.d/samba.sh +++ b/etc/nextcloudpi-config.d/samba.sh @@ -29,11 +29,9 @@ install() grep -q mkdir /etc/init.d/smbd || sed -i "/\