diff options
author | nachoparker <nacho@ownyourbits.com> | 2017-04-27 09:12:51 +0300 |
---|---|---|
committer | nachoparker <nacho@ownyourbits.com> | 2017-04-27 19:49:22 +0300 |
commit | 64bf42f2f3dd18f294d8626aaf412c90760277f0 (patch) | |
tree | 4b431bc211c34d75e5bec7ec7abee2c2b0e5c5d5 | |
parent | fb994adc457588d0361797dfe3a5f0e5a09be230 (diff) |
added show_info() to nextcloudpi-configv0.8.1
-rwxr-xr-x | bin/nextcloudpi-config | 1 | ||||
-rwxr-xr-x | etc/library.sh | 12 | ||||
-rwxr-xr-x | etc/nextcloudpi-config.d/NFS.sh | 9 | ||||
-rwxr-xr-x | etc/nextcloudpi-config.d/letsencrypt.sh | 9 | ||||
-rwxr-xr-x | etc/nextcloudpi-config.d/modsecurity.sh | 10 | ||||
-rwxr-xr-x | etc/nextcloudpi-config.d/nc-ramlogs.sh | 10 | ||||
-rwxr-xr-x | etc/nextcloudpi-config.d/nc-scan-auto.sh | 7 | ||||
-rwxr-xr-x | etc/nextcloudpi-config.d/nc-wifi.sh | 25 | ||||
-rwxr-xr-x | etc/nextcloudpi-config.d/no-ip.sh | 9 | ||||
-rw-r--r-- | 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 176daf3f..fc3fda21 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 95948c20..a3330fce 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 fb55554f..2e64f407 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 76583d41..415288e7 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 37a1b8ea..ce53f662 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 3e75286f..dc8b8ccc 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 0f495959..285d025f 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 0ab9d7ed..f71ada4a 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 afaaf55b..1183a7c2 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 0de3bed8..95e87608 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 "/\<start)/amkdir -p /var/log/samba" /etc/init.d/smbd } -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 SAMBA, @@ -41,7 +39,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_"; } |