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>2018-06-18 16:00:37 +0300
committernachoparker <nacho@ownyourbits.com>2018-06-18 17:19:25 +0300
commit7b2737bf5fbb1c5fa597f60d4adbe80521e56717 (patch)
tree44e7fca6b885363f56dce201cc500a79499bcbf5
parent7ac184752e96d098bb87767c26f1313323fbe961 (diff)
nc-static-IP: autodetect default interfacev0.57.2
-rw-r--r--changelog.md4
-rw-r--r--etc/ncp-config.d/nc-static-IP.sh20
2 files changed, 14 insertions, 10 deletions
diff --git a/changelog.md b/changelog.md
index 31744c75..0e53a766 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,5 +1,7 @@
-[v0.57.1](https://github.com/nextcloud/nextcloudpi/commit/5483031) (2018-06-18) nc-limits: replace systemd for service
+[v0.57.2](https://github.com/nextcloud/nextcloudpi/commit/09943a8) (2018-06-18) nc-static-IP: autodetect default interface
+
+[v0.57.1](https://github.com/nextcloud/nextcloudpi/commit/1c3d0c0) (2018-06-18) docker: replace systemd for service
[v0.57.0](https://github.com/nextcloud/nextcloudpi/commit/ef5839d) (2018-06-18) update to NC 13.0.4
diff --git a/etc/ncp-config.d/nc-static-IP.sh b/etc/ncp-config.d/nc-static-IP.sh
index 30f5e9bd..25e089d9 100644
--- a/etc/ncp-config.d/nc-static-IP.sh
+++ b/etc/ncp-config.d/nc-static-IP.sh
@@ -18,6 +18,8 @@ configure()
local GW="$( ip r | grep "default via" | awk '{ print $3 }' )"
local DNS="$( grep nameserver /etc/resolv.conf | head -1 | awk '{ print $2 }' )"
[[ "$DNS" == "" ]] && DNS="$GW"
+ local IFACE="$( ip r | grep "default via" | awk '{ print $5 }' | head -1 )"
+ [[ "$IFACE" == "" ]] && { echo "Couldn't find default interface"; exit 1; }
## DHCPCD
[[ -f /etc/dhcpcd.conf ]] && {
@@ -34,7 +36,7 @@ configure()
cat >> /etc/dhcpcd.conf <<EOF
# NextCloudPi autogenerated
# don't modify! better use ncp-config
-interface eth0
+interface $IFACE
static ip_address=$IP_/24
static routers=$GW
static domain_name_servers=$DNS
@@ -53,10 +55,10 @@ EOF
[[ $ACTIVE_ != "yes" ]] && {
cat > /etc/network/interfaces <<EOF
# Wired adapter #1
-allow-hotplug eth0
-no-auto-down eth0
-auto eth0
-iface eth0 inet dhcp
+allow-hotplug $IFACE
+no-auto-down $IFACE
+auto $IFACE
+iface $IFACE inet dhcp
# Local loopback
auto lo
@@ -75,10 +77,10 @@ source /etc/network/interfaces.d/*
auto lo
iface lo inet loopback
-# Interface eth0
-auto eth0
-allow-hotplug eth0
-iface eth0 inet static
+# Interface $IFACE
+auto $IFACE
+allow-hotplug $IFACE
+iface $IFACE inet static
address $IP_
netmask 255.255.255.0
gateway $GW