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>2019-01-17 04:42:44 +0300
committernachoparker <nacho@ownyourbits.com>2019-01-17 04:42:44 +0300
commit1f11d40c47811d6f18373af5d1d80d7f48be8e36 (patch)
tree6a5d46c4b0829d39c2b7b175b22dfd4d6cadf26a
parentbab2d22b3a4fcc1689a4ab003df7bac253d44317 (diff)
add public IP to trusted domainsv1.3.12
-rw-r--r--ncp.sh13
-rwxr-xr-xupdate.sh17
2 files changed, 25 insertions, 5 deletions
diff --git a/ncp.sh b/ncp.sh
index 0ba7bbe9..71872fa3 100644
--- a/ncp.sh
+++ b/ncp.sh
@@ -158,13 +158,16 @@ EOF
#!/bin/bash
# wicd service finishes before completing DHCP
while :; do
- IFACE="$( ip r | grep "default via" | awk '{ print $5 }' | head -1 )"
- IP="$( ip a show dev "$IFACE" | grep global | grep -oP '\d{1,3}(.\d{1,3}){3}' | head -1 )"
- [[ "$IP" != "" ]] && break
+ iface="$( ip r | grep "default via" | awk '{ print $5 }' | head -1 )"
+ ip="$( ip a show dev "$iface" | grep global | grep -oP '\d{1,3}(.\d{1,3}){3}' | head -1 )"
+
+ public_ip="$(curl icanhazip.com 2>/dev/null)"
+ [[ "$public_ip" != "" ]] && ncc config:system:set trusted_domains 11 --value="$public_ip"
+
+ [[ "$ip" != "" ]] && break
sleep 3
done
-cd /var/www/nextcloud
-sudo -u www-data php occ config:system:set trusted_domains 1 --value=$IP
+ncc config:system:set trusted_domains 1 --value=$ip
EOF
[[ "$DOCKERBUILD" != 1 ]] && systemctl enable nextcloud-domain
diff --git a/update.sh b/update.sh
index 3722867e..93dab4a6 100755
--- a/update.sh
+++ b/update.sh
@@ -255,6 +255,23 @@ EOF
install_app nc-backup
install_app nc-restore
+ # add public IP to trusted domains
+ cat > /usr/local/bin/nextcloud-domain.sh <<'EOF'
+#!/bin/bash
+# wicd service finishes before completing DHCP
+while :; do
+ iface="$( ip r | grep "default via" | awk '{ print $5 }' | head -1 )"
+ ip="$( ip a show dev "$iface" | grep global | grep -oP '\d{1,3}(.\d{1,3}){3}' | head -1 )"
+
+ public_ip="$(curl icanhazip.com 2>/dev/null)"
+ [[ "$public_ip" != "" ]] && ncc config:system:set trusted_domains 11 --value="$public_ip"
+
+ [[ "$ip" != "" ]] && break
+ sleep 3
+done
+ncc config:system:set trusted_domains 1 --value=$ip
+EOF
+
# remove redundant opcache configuration. Leave until update bug is fixed -> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=815968
# Bug #416 reappeared after we moved to php7.2 and debian buster packages. (keep last)
[[ "$( ls -l /etc/php/7.2/fpm/conf.d/*-opcache.ini | wc -l )" -gt 1 ]] && rm "$( ls /etc/php/7.2/fpm/conf.d/*-opcache.ini | tail -1 )"