Skip to content

Commit

Permalink
fix nextcloud-domain running before default GW is ready
Browse files Browse the repository at this point in the history
  • Loading branch information
nachoparker committed Jun 19, 2018
1 parent 9210fb2 commit 1a9a53f
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
6 changes: 4 additions & 2 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@

[v0.57.4](https://github.com/nextcloud/nextcloudpi/commit/c00fbce) (2018-06-18) letsencrypt: install from debian package
[v0.57.5](https://github.com/nextcloud/nextcloudpi/commit/444e762) (2018-06-18) fix nextcloud-domain running before default GW is ready

[v0.57.3](https://github.com/nextcloud/nextcloudpi/commit/a74248b) (2018-06-18) armbian: default to SSH disabled
[v0.57.4](https://github.com/nextcloud/nextcloudpi/commit/ce2d38c) (2018-06-18) letsencrypt: install from debian package

[v0.57.3 ](https://github.com/nextcloud/nextcloudpi/commit/a74248b) (2018-06-18) armbian: default to SSH disabled

[v0.57.2 ](https://github.com/nextcloud/nextcloudpi/commit/5479305) (2018-06-18) nc-static-IP: autodetect default interface

Expand Down
8 changes: 4 additions & 4 deletions ncp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,12 @@ EOF

cat > /usr/local/bin/nextcloud-domain.sh <<'EOF'
#!/bin/bash
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
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
sleep 3
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
Expand Down
15 changes: 15 additions & 0 deletions update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,21 @@ EOF
apt-get install -y --no-install-recommends letsencrypt
}

# fix nextcloud-domain running before default GW is ready
pkill -f nextcloud-domain
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 )"
[[ "$IP" != "" ]] && break
sleep 3
done
cd /var/www/nextcloud
sudo -u www-data php occ config:system:set trusted_domains 1 --value=$IP
EOF

} # end - only live updates

exit 0
Expand Down

0 comments on commit 1a9a53f

Please sign in to comment.