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>2017-07-26 07:49:52 +0300
committernachoparker <nacho@ownyourbits.com>2017-08-11 00:17:56 +0300
commit1344a7da0dff9f3d0bf0f183acf71edb6e683225 (patch)
tree66bc85840ccc5b7fafef9bb45bcd9053ef4d64fd
parenta7a463718c51f0ca37ae440f5a952cfd4cd04b46 (diff)
dnsmasq detect ipv0.17.6
-rw-r--r--etc/nextcloudpi-config.d/dnsmasq.sh8
1 files changed, 6 insertions, 2 deletions
diff --git a/etc/nextcloudpi-config.d/dnsmasq.sh b/etc/nextcloudpi-config.d/dnsmasq.sh
index a3f70a61..c59cf5d5 100644
--- a/etc/nextcloudpi-config.d/dnsmasq.sh
+++ b/etc/nextcloudpi-config.d/dnsmasq.sh
@@ -16,7 +16,6 @@
ACTIVE_=no
DOMAIN_=mycloud.ownyourbits.com
-IP_=127.0.0.1
DNSSERVER_=8.8.8.8
CACHESIZE_=150
DESCRIPTION="DNS server with cache"
@@ -41,6 +40,11 @@ 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 )
+
+ [[ "$IP" == "" ]] && { echo "could not detect IP"; return 1; }
+
cat > /etc/dnsmasq.conf <<EOF
domain-needed # Never forward plain names (without a dot or domain part)
bogus-priv # Never forward addresses in the non-routed address spaces.
@@ -48,7 +52,7 @@ no-poll # Don't poll for changes in /etc/resolv.conf
no-resolv # Don't use /etc/resolv.conf or any other file
cache-size=$CACHESIZE_
server=$DNSSERVER_
-address=/$DOMAIN_/$IP_ # This is optional if we add it to /etc/hosts
+address=/$DOMAIN_/$IP # This is optional if we add it to /etc/hosts
EOF
sed -i 's|#\?IGNORE_RESOLVCONF=.*|IGNORE_RESOLVCONF=yes|' /etc/default/dnsmasq