diff options
author | nachoparker <nacho@ownyourbits.com> | 2017-04-27 19:28:17 +0300 |
---|---|---|
committer | nachoparker <nacho@ownyourbits.com> | 2017-05-22 19:55:44 +0300 |
commit | aae76636cc31a6f6ec68562ca73d895be711879d (patch) | |
tree | 3686ce816b2cce42881bb69d5793bba8a68e43ac | |
parent | 092d22acbcd87dc136a7595d9d4802add44e5270 (diff) |
show ✓ if an item is activated in nextcloudpi-configv0.8.6
-rwxr-xr-x | bin/nextcloudpi-config | 73 | ||||
-rwxr-xr-x | etc/nextcloudpi-config.d/dnsmasq.sh | 2 | ||||
-rwxr-xr-x | etc/nextcloudpi-config.d/fail2ban.sh | 2 | ||||
-rwxr-xr-x | etc/nextcloudpi-config.d/nc-ramlogs.sh | 2 | ||||
-rwxr-xr-x | etc/nextcloudpi-config.d/no-ip.sh | 2 |
5 files changed, 45 insertions, 36 deletions
diff --git a/bin/nextcloudpi-config b/bin/nextcloudpi-config index edb66f57..1b701a0c 100755 --- a/bin/nextcloudpi-config +++ b/bin/nextcloudpi-config @@ -16,43 +16,52 @@ source /usr/local/etc/library.sh function nextcloud-config() { - local DIALOG_OK=0 - local LIST=() - local VERFILE=/var/run/.ncp-latest-version - local BACKTITLE="NextCloudPi configuration ver. " - local CONFDIR=/usr/local/etc/nextcloudpi-config.d/ + { + local DIALOG_OK=0 + local VERFILE=/var/run/.ncp-latest-version + local BACKTITLE="NextCloudPi configuration ver. " + local CONFDIR=/usr/local/etc/nextcloudpi-config.d/ - # save latest version if it has never done before - test -f $VERFILE || ncp-check-version + # save latest version if it has never done before + test -f $VERFILE || ncp-check-version - # ask for update if outdated - ncp-test-updates && \ - whiptail --backtitle "$BACKTITLE $( cat /usr/local/etc/ncp-version )" \ - --title "NextCloudPi update available" \ - --clear --yesno "Update to $( cat $VERFILE )?" \ - 10 40 - [[ $? -eq $DIALOG_OK ]] && ncp-update + # ask for update if outdated + ncp-test-updates && \ + whiptail --backtitle "$BACKTITLE $( cat /usr/local/etc/ncp-version )" \ + --title "NextCloudPi update available" \ + --clear --yesno "Update to $( cat $VERFILE )?" \ + 10 40 + [[ $? -eq $DIALOG_OK ]] && ncp-update - # launch the selection menu - for item in $CONFDIR/*.sh; do - local DESC=$( grep "DESCRIPTION=" $item | sed 's|^DESCRIPTION="||;s|"$||' ) - LIST+=( $( basename $item .sh ) "$DESC" ) - done - while true; do - local script - script=$( whiptail --backtitle "$BACKTITLE $( cat /usr/local/etc/ncp-version )" \ - --title "NextCloudPi Software Configuration Tool (nextcloudpi-config)" \ - --cancel-button Finish --ok-button Select \ - --menu "Select program to configure and activate:" 20 100 10 \ - "${LIST[@]}" \ - 3>&1 1>&2 2>&3 ) + while true; do + # fill options + local LIST=() + for item in $CONFDIR/*.sh; do + local DESC=$( grep "DESCRIPTION=" $item | sed 's|^DESCRIPTION="||;s|"$||' ) + grep -q "^ACTIVE_=yes" $item && local ON="✓" || local ON=" " + LIST+=( "$ON $( basename $item .sh )" "$DESC" ) + done - [[ $? -ne $DIALOG_OK ]] || [[ "$script" == "" ]] && return 0 + # launch the selection menu + local script + script=$( whiptail --backtitle "$BACKTITLE $( cat /usr/local/etc/ncp-version )" \ + --title "NextCloudPi Software Configuration Tool (nextcloudpi-config)" \ + --cancel-button Finish --ok-button Select \ + --menu "Select program to configure and activate:" 20 105 10 \ + "${LIST[@]}" \ + 3>&1 1>&2 2>&3 ) - # launch selected script - info_script $script.sh || continue; - configure_script $script.sh - done + [[ $? -ne $DIALOG_OK ]] || [[ "$script" == "" ]] && return 0 + + # remove ✓ and spaces + script=$( sed 's=✓\| ==g' <<< "$script" ) + + # launch selected script + info_script $script.sh || continue; + configure_script $script.sh + done + return + } # force to read the whole thing into memory, as its contents might change in update.sh } if [ $(id -u) -ne 0 ]; then diff --git a/etc/nextcloudpi-config.d/dnsmasq.sh b/etc/nextcloudpi-config.d/dnsmasq.sh index 81ac3a3d..03b16adf 100755 --- a/etc/nextcloudpi-config.d/dnsmasq.sh +++ b/etc/nextcloudpi-config.d/dnsmasq.sh @@ -14,7 +14,7 @@ # More at: https://ownyourbits.com/2017/03/09/dnsmasq-as-dns-cache-server-for-nextcloudpi-and-raspbian/ # -ACTIVE_=yes +ACTIVE_=no DOMAIN_=mycloud.ownyourbits.com IP_=127.0.0.1 DNSSERVER_=8.8.8.8 diff --git a/etc/nextcloudpi-config.d/fail2ban.sh b/etc/nextcloudpi-config.d/fail2ban.sh index cc2add4a..0bd007d3 100755 --- a/etc/nextcloudpi-config.d/fail2ban.sh +++ b/etc/nextcloudpi-config.d/fail2ban.sh @@ -14,7 +14,7 @@ # More at: https://ownyourbits.com/2017/02/24/nextcloudpi-fail2ban-installer/ # -ACTIVE_=yes +ACTIVE_=no # location of Nextcloud logs NCLOG_=/var/www/nextcloud/data/nextcloud.log diff --git a/etc/nextcloudpi-config.d/nc-ramlogs.sh b/etc/nextcloudpi-config.d/nc-ramlogs.sh index dc8b8ccc..aaf917be 100755 --- a/etc/nextcloudpi-config.d/nc-ramlogs.sh +++ b/etc/nextcloudpi-config.d/nc-ramlogs.sh @@ -16,7 +16,7 @@ # ACTIVE_=no -DESCRIPTION="mount logs in RAM to prevent SD card degradation (faster, consumes more RAM)" +DESCRIPTION="mount logs in RAM to prevent SD degradation (faster, consumes more RAM)" show_info() { diff --git a/etc/nextcloudpi-config.d/no-ip.sh b/etc/nextcloudpi-config.d/no-ip.sh index 1183a7c2..19db2c62 100755 --- a/etc/nextcloudpi-config.d/no-ip.sh +++ b/etc/nextcloudpi-config.d/no-ip.sh @@ -15,7 +15,7 @@ # More at https://ownyourbits.com/2017/03/05/dynamic-dns-for-raspbian-with-no-ip-org-installer/ # -ACTIVE_=yes +ACTIVE_=no USER_=my-noip-user@email.com PASS_=noip-pass TIME_=30 |