Skip to content

Commit

Permalink
fix IP regex
Browse files Browse the repository at this point in the history
  • Loading branch information
nachoparker committed Sep 1, 2017
1 parent a695c16 commit e5790d4
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docker/run-nc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ test -e /data/config && {

# 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 | grep "global $IFACE" | grep -oP '\d{1,3}(\.\d{1,3}){3}' | head -1 )
sudo -u www-data php $OCC config:system:set trusted_domains 2 --value="$IP"

echo "Starting Apache"
Expand Down
2 changes: 1 addition & 1 deletion docker/run-ncdocker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

# Initial Trusted Domain
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 | grep "global $IFACE" | grep -oP '\d{1,3}(\.\d{1,3}){3}' | head -1 )

docker run -d -p 443:443 -p 80:80 -v ncdata:/data --name nextcloudpi ownyourbits/nextcloudpi $IP
2 changes: 1 addition & 1 deletion etc/nextcloudpi-config.d/dnsmasq.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,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 | grep "global $IFACE" | 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/nextcloudpi-config.d/nc-forward-ports.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,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 | grep "global $IFACE" | 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
Expand Down
2 changes: 1 addition & 1 deletion nextcloudpi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ 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 | grep "global $IFACE" | grep -oP '\d{1,3}(\.\d{1,3}){3}' | head -1 )
# wicd service finishes before completing DHCP
while [[ "$IP" == "" ]]; do
sleep 3
Expand Down

0 comments on commit e5790d4

Please sign in to comment.