Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/nextcloudpi.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornachoparker <nacho@ownyourbits.com>2017-05-23 19:37:15 +0300
committernachoparker <nacho@ownyourbits.com>2017-05-23 19:44:47 +0300
commit06423bf4ae86ec695d4dcde482f1f316a79e5cd6 (patch)
tree94bfd8f1fbf0f7e2b35c0866137b0245fe3d9e11
parent0479dbbea887698f0632967ed28e05a8d7d78405 (diff)
if ACTIVE=yes by default, launch configure for that script on updatev0.11.1
-rwxr-xr-xetc/library.sh11
-rw-r--r--etc/nextcloudpi-config.d/NFS.sh3
-rw-r--r--etc/nextcloudpi-config.d/dnsmasq.sh2
-rw-r--r--etc/nextcloudpi-config.d/fail2ban.sh2
-rw-r--r--etc/nextcloudpi-config.d/nc-scan-auto.sh6
-rw-r--r--etc/nextcloudpi-config.d/nc-wifi.sh10
-rw-r--r--etc/nextcloudpi-config.d/no-ip.sh2
-rw-r--r--etc/nextcloudpi-config.d/samba.sh3
-rwxr-xr-xupdate.sh9
9 files changed, 40 insertions, 8 deletions
diff --git a/etc/library.sh b/etc/library.sh
index 12ae1de6..c594d68f 100755
--- a/etc/library.sh
+++ b/etc/library.sh
@@ -202,6 +202,17 @@ function install_script()
)
}
+function activate_script()
+{
+ (
+ local SCRIPT=$1
+ source ./$SCRIPT
+ echo -e "Activating \e[1m$( basename $SCRIPT .sh )\e[0m"
+ set +x
+ configure
+ )
+}
+
function info_script()
{
(
diff --git a/etc/nextcloudpi-config.d/NFS.sh b/etc/nextcloudpi-config.d/NFS.sh
index 2e64f407..31d6837c 100644
--- a/etc/nextcloudpi-config.d/NFS.sh
+++ b/etc/nextcloudpi-config.d/NFS.sh
@@ -14,6 +14,7 @@
# More at: https://ownyourbits.com
#
+ACTIVE_=no
DIR_=/media/USBdrive/ncdata/admin/files
SUBNET_=192.168.1.0/24
USER_=www-data
@@ -41,6 +42,8 @@ from 'nextcloudpi-config'" \
configure()
{
+ [[ $ACTIVE_ != "yes" ]] && { service nfs-kernel-server stop; systemctl disable nfs-kernel-server; return; }
+
# CHECKS
################################
[ -d "$DIR_" ] || { echo -e "INFO: directory $DIR_ does not exist. Creating"; mkdir -p "$DIR_"; }
diff --git a/etc/nextcloudpi-config.d/dnsmasq.sh b/etc/nextcloudpi-config.d/dnsmasq.sh
index 03b16adf..d475c51f 100644
--- a/etc/nextcloudpi-config.d/dnsmasq.sh
+++ b/etc/nextcloudpi-config.d/dnsmasq.sh
@@ -30,7 +30,7 @@ install()
configure()
{
- [[ $ACTIVE_ == "no" ]] && { service dnsmasq stop; update-rc.d dnsmasq disable; return; }
+ [[ $ACTIVE_ != "yes" ]] && { service dnsmasq stop; update-rc.d dnsmasq disable; return; }
cat > /etc/dnsmasq.conf <<EOF
domain-needed # Never forward plain names (without a dot or domain part)
diff --git a/etc/nextcloudpi-config.d/fail2ban.sh b/etc/nextcloudpi-config.d/fail2ban.sh
index 0bd007d3..91085e93 100644
--- a/etc/nextcloudpi-config.d/fail2ban.sh
+++ b/etc/nextcloudpi-config.d/fail2ban.sh
@@ -39,7 +39,7 @@ install()
configure()
{
- [[ $ACTIVE_ == "no" ]] && { service fail2ban stop; update-rc.d fail2ban disable; return; }
+ [[ $ACTIVE_ != "yes" ]] && { service fail2ban stop; update-rc.d fail2ban disable; return; }
touch /var/www/nextcloud/data/nextcloud.log
chown -R www-data /var/www/nextcloud/data
diff --git a/etc/nextcloudpi-config.d/nc-scan-auto.sh b/etc/nextcloudpi-config.d/nc-scan-auto.sh
index 285d025f..81235944 100644
--- a/etc/nextcloudpi-config.d/nc-scan-auto.sh
+++ b/etc/nextcloudpi-config.d/nc-scan-auto.sh
@@ -14,6 +14,7 @@
# More at: https://ownyourbits.com
#
+ACTIVE_=no
SCANINTERVAL_=60
DESCRIPTION="Periodically scan NC for externally modified files"
@@ -23,14 +24,13 @@ show_info()
--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." \
+>>> If there are too many files this can greatly affect performance. <<<" \
20 90
}
configure()
{
- [[ $SCANINTERVAL_ == 0 ]] && {
+ [[ $ACTIVE_ != "yes" ]] && {
systemctl stop nc-scan.timer
systemctl disable nc-scan.timer
return 0
diff --git a/etc/nextcloudpi-config.d/nc-wifi.sh b/etc/nextcloudpi-config.d/nc-wifi.sh
index f13abec3..a59d0a9d 100644
--- a/etc/nextcloudpi-config.d/nc-wifi.sh
+++ b/etc/nextcloudpi-config.d/nc-wifi.sh
@@ -15,6 +15,7 @@
# More at https://ownyourbits.com/
#
+ACTIVE_=no
DESCRIPTION="Configure your Wi-Fi connection"
install()
@@ -40,6 +41,15 @@ show_info()
configure()
{
+ [[ $ACTIVE_ != "yes" ]] && {
+ systemctl stop wicd
+ systemctl disable wicd
+ systemctl start dhcpcd
+ systemctl enable dhcpcd
+ systemctl start nextcloud-domain
+ return;
+ }
+
# Installation in QEMU (without a wireless interface) produces
# wicd installation to generate 'wireless_interface = None'.
# It does not hurt to restart it to wlan0 for RPi3 & zero w
diff --git a/etc/nextcloudpi-config.d/no-ip.sh b/etc/nextcloudpi-config.d/no-ip.sh
index aa0336a3..17f44e52 100644
--- a/etc/nextcloudpi-config.d/no-ip.sh
+++ b/etc/nextcloudpi-config.d/no-ip.sh
@@ -63,7 +63,7 @@ show_info()
configure()
{
- [[ $ACTIVE_ == "no" ]] && { service noip2 stop; update-rc.d noip2 disable; return; }
+ [[ $ACTIVE_ != "yes" ]] && { service noip2 stop; update-rc.d noip2 disable; return; }
/usr/local/bin/noip2 -C -c /usr/local/etc/no-ip2.conf -U $TIME_ -u $USER_ -p $PASS_
update-rc.d noip2 defaults
diff --git a/etc/nextcloudpi-config.d/samba.sh b/etc/nextcloudpi-config.d/samba.sh
index 95e87608..5e9e8d23 100644
--- a/etc/nextcloudpi-config.d/samba.sh
+++ b/etc/nextcloudpi-config.d/samba.sh
@@ -14,6 +14,7 @@
# More at: https://ownyourbits.com
#
+ACTIVE_=no
DIR_=/media/USBdrive/ncdata/admin/files
USER_=pi
PWD_=raspberry
@@ -43,6 +44,8 @@ from 'nextcloudpi-config'" \
configure()
{
+ [[ $ACTIVE_ != "yes" ]] && { service smbd stop; update-rc.d smbd disable; return; }
+
# CHECKS
################################
[ -d "$DIR_" ] || { echo -e "INFO: directory $DIR_ does not exist. Creating"; mkdir -p "$DIR_"; }
diff --git a/update.sh b/update.sh
index c23f0ebb..d6b6d76e 100755
--- a/update.sh
+++ b/update.sh
@@ -21,8 +21,13 @@ done
# install new entries of nextcloudpi-config and update others
for file in etc/nextcloudpi-config.d/*; do
- [ -f $file ] || continue;
- [ -f /usr/local/$file ] || install_script $file
+ [ -f $file ] || continue; # skip dirs
+ [ -f /usr/local/$file ] || { # new entry
+ install_script $file # install
+
+ # configure if active by default
+ grep -q '^ACTIVE_=yes$' $file && activate_script $file
+ }
# save current configuration to (possibly) updated script
[ -f /usr/local/$file ] && {