From 1a9a53fce36d6b1f68b75eb861759e1adc85ba36 Mon Sep 17 00:00:00 2001 From: nachoparker Date: Mon, 18 Jun 2018 17:18:18 +0200 Subject: [PATCH] fix nextcloud-domain running before default GW is ready --- changelog.md | 6 ++++-- ncp.sh | 8 ++++---- update.sh | 15 +++++++++++++++ 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/changelog.md b/changelog.md index 815514e3f..f15896dcc 100644 --- a/changelog.md +++ b/changelog.md @@ -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 diff --git a/ncp.sh b/ncp.sh index 01fdcc148..f2a093086 100644 --- a/ncp.sh +++ b/ncp.sh @@ -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 diff --git a/update.sh b/update.sh index eaea62b2f..d038aa7e3 100755 --- a/update.sh +++ b/update.sh @@ -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