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-11-16 21:21:10 +0300
committernachoparker <nacho@ownyourbits.com>2017-11-16 21:21:42 +0300
commit7e126fdda9bcdc5778c231e144006fbb16b2f1b4 (patch)
treea752144632bcb571e1e52cfaa20f1aef5de3f51b
parentac9989dd28dd780eba6afdb198402d7c8a58f7c1 (diff)
improve IP detectionv0.34.13
-rwxr-xr-xdocker-armhf/nextcloud/020nextcloud2
-rwxr-xr-xdocker/nextcloud/020nextcloud2
-rw-r--r--etc/nextcloudpi-config.d/dnsmasq.sh2
-rw-r--r--etc/nextcloudpi-config.d/nc-forward-ports.sh2
-rw-r--r--etc/nextcloudpi-config.d/nc-notify-updates.sh2
-rw-r--r--nextcloudpi.sh4
6 files changed, 7 insertions, 7 deletions
diff --git a/docker-armhf/nextcloud/020nextcloud b/docker-armhf/nextcloud/020nextcloud
index 48076ad2..0dda6b23 100755
--- a/docker-armhf/nextcloud/020nextcloud
+++ b/docker-armhf/nextcloud/020nextcloud
@@ -39,7 +39,7 @@ test -f /data/app/config/config.php || {
# Trusted Domain ( local IP )
IFACE=$( ip r | grep "default via" | awk '{ print $5 }' )
-IP=$( ip a | grep "global $IFACE" | grep -oP '\d{1,3}(\.\d{1,3}){3}' | head -1 )
+IP=$( ip a show dev "$IFACE" | grep global | grep -oP '\d{1,3}(.\d{1,3}){3}' | head -1 )
sudo -u www-data php "$OCC" config:system:set trusted_domains 1 --value="$IP"
# Trusted Domain ( as an argument )
diff --git a/docker/nextcloud/020nextcloud b/docker/nextcloud/020nextcloud
index 48076ad2..0dda6b23 100755
--- a/docker/nextcloud/020nextcloud
+++ b/docker/nextcloud/020nextcloud
@@ -39,7 +39,7 @@ test -f /data/app/config/config.php || {
# Trusted Domain ( local IP )
IFACE=$( ip r | grep "default via" | awk '{ print $5 }' )
-IP=$( ip a | grep "global $IFACE" | grep -oP '\d{1,3}(\.\d{1,3}){3}' | head -1 )
+IP=$( ip a show dev "$IFACE" | grep global | grep -oP '\d{1,3}(.\d{1,3}){3}' | head -1 )
sudo -u www-data php "$OCC" config:system:set trusted_domains 1 --value="$IP"
# Trusted Domain ( as an argument )
diff --git a/etc/nextcloudpi-config.d/dnsmasq.sh b/etc/nextcloudpi-config.d/dnsmasq.sh
index 2d416189..b4ce9cd0 100644
--- a/etc/nextcloudpi-config.d/dnsmasq.sh
+++ b/etc/nextcloudpi-config.d/dnsmasq.sh
@@ -55,7 +55,7 @@ configure()
[[ $ACTIVE_ != "yes" ]] && { service dnsmasq stop; update-rc.d dnsmasq disable; return; }
local IFACE=$( ip r | grep "default via" | awk '{ print $5 }' )
- local IP=$( ip a | grep "global $IFACE" | grep -oP '\d{1,3}(\.\d{1,3}){3}' | head -1 )
+ local IP=$( ip a show dev "$IFACE" | grep global | grep -oP '\d{1,3}(.\d{1,3}){3}' | head -1 )
[[ "$IP" == "" ]] && { echo "could not detect IP"; return 1; }
diff --git a/etc/nextcloudpi-config.d/nc-forward-ports.sh b/etc/nextcloudpi-config.d/nc-forward-ports.sh
index 7c855d1c..09123cb4 100644
--- a/etc/nextcloudpi-config.d/nc-forward-ports.sh
+++ b/etc/nextcloudpi-config.d/nc-forward-ports.sh
@@ -34,7 +34,7 @@ install()
configure()
{
local IFACE=$( ip r | grep "default via" | awk '{ print $5 }' )
- local IP=$( ip a | grep "global $IFACE" | grep -oP '\d{1,3}(\.\d{1,3}){3}' | head -1 )
+ local IP=$( ip a show dev "$IFACE" | grep global | grep -oP '\d{1,3}(.\d{1,3}){3}' | head -1 )
upnpc -d "$HTTPSPORT_" TCP
upnpc -d "$HTTPPORT_" TCP
upnpc -a "$IP" 443 "$HTTPSPORT_" TCP | tee >(cat - >&2) | grep -q "is redirected to internal" || \
diff --git a/etc/nextcloudpi-config.d/nc-notify-updates.sh b/etc/nextcloudpi-config.d/nc-notify-updates.sh
index 4e1288c7..a73e225c 100644
--- a/etc/nextcloudpi-config.d/nc-notify-updates.sh
+++ b/etc/nextcloudpi-config.d/nc-notify-updates.sh
@@ -64,7 +64,7 @@ test -e \$NOTIFIED && [[ "\$( cat \$LATEST )" == "\$( cat \$NOTIFIED )" ]] && {
echo "Found update from \$( cat \$VERFILE ) to \$( cat \$LATEST ). Sending notification..."
IFACE=\$( ip r | grep "default via" | awk '{ print \$5 }' )
-IP=\$( ip a | grep "global \$IFACE" | grep -oP '\d{1,3}(\.\d{1,3}){3}' | head -1 )
+IP=\$( ip a show dev "\$IFACE" | grep global | grep -oP '\d{1,3}(\.\d{1,3}){3}' | head -1 )
sudo -u www-data php /var/www/nextcloud/occ notification:generate \
$USER_ "NextCloudPi update" \
diff --git a/nextcloudpi.sh b/nextcloudpi.sh
index ed0cbd7a..a7141e9f 100644
--- a/nextcloudpi.sh
+++ b/nextcloudpi.sh
@@ -139,11 +139,11 @@ EOF
cat > /usr/local/bin/nextcloud-domain.sh <<'EOF'
#!/bin/bash
IFACE=$( ip r | grep "default via" | awk '{ print $5 }' )
-IP=$( ip a | grep "global $IFACE" | grep -oP '\d{1,3}(\.\d{1,3}){3}' | head -1 )
+IP=$( ip a show dev "$IFACE" | grep global | grep -oP '\d{1,3}(.\d{1,3}){3}' | head -1 )
# wicd service finishes before completing DHCP
while [[ "$IP" == "" ]]; do
sleep 3
- IP=$( ip a | grep "global $IFACE" | grep -oP '\d{1,3}(\.\d{1,3}){3}' | head -1 )
+ IP=$( ip a show dev "$IFACE" | grep global | grep -oP '\d{1,3}(.\d{1,3}){3}' | head -1 )
done
cd /var/www/nextcloud
sudo -u www-data php occ config:system:set trusted_domains 1 --value=$IP