Skip to content

Commit

Permalink
fix double default gateway
Browse files Browse the repository at this point in the history
  • Loading branch information
nachoparker committed Apr 22, 2018
1 parent 1ddeebf commit 20c734b
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions bin/ncp-diag
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ echo "port check 80|$( is_port_open 80 )"
echo "port check 443|$( is_port_open 443 )"

# LAN
IFACE=$( ip r | grep "default via" | awk '{ print $5 }' )
GW=$( ip r | grep "default via" | awk '{ print $3 }' )
IFACE=$( ip r | grep "default via" | awk '{ print $5 }' | head -1 )
GW=$( ip r | grep "default via" | awk '{ print $3 }' | head -1 )
IP=$( ip a show dev "$IFACE" | grep global | grep -oP '\d{1,3}(.\d{1,3}){3}' | head -1 )

echo "IP|$IP"
Expand Down
4 changes: 3 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@

[v0.53.30](https://github.com/nextcloud/nextcloudpi/commit/63f22a2) (2018-04-20) ncp-report: fix root execution
[v0.53.31](https://github.com/nextcloud/nextcloudpi/commit/0f8a193) (2018-04-21) fix double default gateway

[v0.53.30](https://github.com/nextcloud/nextcloudpi/commit/344f184) (2018-04-20) ncp-report: fix root execution

[v0.53.29](https://github.com/nextcloud/nextcloudpi/commit/79529c7) (2018-04-05) renamed to NextCloudPlus

Expand Down
2 changes: 1 addition & 1 deletion docker-common/nextcloud/020nextcloud
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ test -f /data/app/config/config.php || {
}

# Trusted Domain ( local IP )
IFACE=$( ip r | grep "default via" | awk '{ print $5 }' )
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 )
sudo -u www-data php "$OCC" config:system:set trusted_domains 1 --value="$IP"

Expand Down
2 changes: 1 addition & 1 deletion etc/ncp-config.d/dnsmasq.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ configure()
return
}

local IFACE=$( ip r | grep "default via" | awk '{ print $5 }' )
local IFACE=$( ip r | grep "default via" | awk '{ print $5 }' | 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; }
Expand Down
2 changes: 1 addition & 1 deletion etc/ncp-config.d/nc-forward-ports.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ install()

configure()
{
local IFACE=$( ip r | grep "default via" | awk '{ print $5 }' )
local IFACE=$( ip r | grep "default via" | awk '{ print $5 }' | 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
Expand Down
2 changes: 1 addition & 1 deletion etc/ncp-config.d/nc-notify-updates.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,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 }' )
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 )
sudo -u www-data php /var/www/nextcloud/occ notification:generate \
Expand Down
2 changes: 1 addition & 1 deletion nextcloudplus.sh
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ EOF

cat > /usr/local/bin/nextcloud-domain.sh <<'EOF'
#!/bin/bash
IFACE=$( ip r | grep "default via" | awk '{ print $5 }' )
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 )
# wicd service finishes before completing DHCP
while [[ "$IP" == "" ]]; do
Expand Down

0 comments on commit 20c734b

Please sign in to comment.