Pārlūkot izejas kodu

Allow DNS nameservers to be configured

Bob Mottram 10 gadus atpakaļ
vecāks
revīzija
9787e95171
2 mainītis faili ar 26 papildinājumiem un 4 dzēšanām
  1. Binārs
      man/freedombone.1.gz
  2. 26
    4
      src/freedombone

Binārs
man/freedombone.1.gz Parādīt failu


+ 26
- 4
src/freedombone Parādīt failu

81
 # IP address of the router (gateway)
81
 # IP address of the router (gateway)
82
 ROUTER_IP_ADDRESS="192.168.1.254"
82
 ROUTER_IP_ADDRESS="192.168.1.254"
83
 
83
 
84
+# DNS
85
+NAMESERVER1='213.73.91.35'
86
+NAMESERVER2='85.214.20.141'
87
+
84
 # whether to route outgoing traffic through Tor
88
 # whether to route outgoing traffic through Tor
85
 ROUTE_THROUGH_TOR="no"
89
 ROUTE_THROUGH_TOR="no"
86
 
90
 
375
   echo '     --cjdns            Enable CJDNS'
379
   echo '     --cjdns            Enable CJDNS'
376
   echo '     --vpass            VoIP server password'
380
   echo '     --vpass            VoIP server password'
377
   echo '     --vport            VoIP server port'
381
   echo '     --vport            VoIP server port'
382
+  echo '     --ns1              First DNS nameserver'
383
+  echo '     --ns2              Second DNS nameserver'
378
   echo ''
384
   echo ''
379
   echo 'system types'
385
   echo 'system types'
380
   echo '------------'
386
   echo '------------'
1047
     shift
1053
     shift
1048
     VOIP_PORT=$1
1054
     VOIP_PORT=$1
1049
     ;;
1055
     ;;
1056
+    # DNS Nameserver 1
1057
+    --ns1)
1058
+    shift
1059
+    NAMESERVER1=$1
1060
+    ;;
1061
+    # DNS Nameserver 2
1062
+    --ns2)
1063
+    shift
1064
+    NAMESERVER2=$1
1065
+    ;;
1050
     *)
1066
     *)
1051
     # unknown option
1067
     # unknown option
1052
     ;;
1068
     ;;
1099
   fi
1115
   fi
1100
 
1116
 
1101
   if [ -f $CONFIGURATION_FILE ]; then
1117
   if [ -f $CONFIGURATION_FILE ]; then
1118
+      if grep -q "NAMESERVER1" $CONFIGURATION_FILE; then
1119
+          NAMESERVER1=$(grep "NAMESERVER1" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
1120
+      fi
1121
+      if grep -q "NAMESERVER2" $CONFIGURATION_FILE; then
1122
+          NAMESERVER2=$(grep "NAMESERVER2" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
1123
+      fi
1102
       if grep -q "DEBIAN_REPO" $CONFIGURATION_FILE; then
1124
       if grep -q "DEBIAN_REPO" $CONFIGURATION_FILE; then
1103
           DEBIAN_REPO=$(grep "DEBIAN_REPO" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
1125
           DEBIAN_REPO=$(grep "DEBIAN_REPO" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
1104
-		  CHECK_MESSAGE="Check your internet connection, /etc/network/interfaces and /etc/resolv.conf, then delete $COMPLETION_FILE, run 'rm -fR /var/lib/apt/lists/* && apt-get update --fix-missing' and run this script again. If hash sum mismatches persist then try setting $DEBIAN_REPO to a different mirror and also change /etc/apt/sources.list."
1126
+          CHECK_MESSAGE="Check your internet connection, /etc/network/interfaces and /etc/resolv.conf, then delete $COMPLETION_FILE, run 'rm -fR /var/lib/apt/lists/* && apt-get update --fix-missing' and run this script again. If hash sum mismatches persist then try setting $DEBIAN_REPO to a different mirror and also change /etc/apt/sources.list."
1105
       fi
1127
       fi
1106
       if grep -q "VOIP_PORT" $CONFIGURATION_FILE; then
1128
       if grep -q "VOIP_PORT" $CONFIGURATION_FILE; then
1107
           VOIP_PORT=$(grep "VOIP_PORT" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
1129
           VOIP_PORT=$(grep "VOIP_PORT" $CONFIGURATION_FILE | awk -F '=' '{print $2}')
1386
   echo "    address $LOCAL_NETWORK_STATIC_IP_ADDRESS" >> /etc/network/interfaces
1408
   echo "    address $LOCAL_NETWORK_STATIC_IP_ADDRESS" >> /etc/network/interfaces
1387
   echo '    netmask 255.255.255.0' >> /etc/network/interfaces
1409
   echo '    netmask 255.255.255.0' >> /etc/network/interfaces
1388
   echo "    gateway $ROUTER_IP_ADDRESS" >> /etc/network/interfaces
1410
   echo "    gateway $ROUTER_IP_ADDRESS" >> /etc/network/interfaces
1389
-  echo '    dns-nameservers 213.73.91.35 85.214.20.141' >> /etc/network/interfaces
1411
+  echo "    dns-nameservers $NAMESERVER1 $NAMESERVER2" >> /etc/network/interfaces
1390
   echo '# Example to keep MAC address between reboots' >> /etc/network/interfaces
1412
   echo '# Example to keep MAC address between reboots' >> /etc/network/interfaces
1391
   echo '#hwaddress ether DE:AD:BE:EF:CA:FE' >> /etc/network/interfaces
1413
   echo '#hwaddress ether DE:AD:BE:EF:CA:FE' >> /etc/network/interfaces
1392
   echo '' >> /etc/network/interfaces
1414
   echo '' >> /etc/network/interfaces
4645
   fi
4667
   fi
4646
   echo 'domain localdomain' > /etc/resolv.conf
4668
   echo 'domain localdomain' > /etc/resolv.conf
4647
   echo 'search localdomain' >> /etc/resolv.conf
4669
   echo 'search localdomain' >> /etc/resolv.conf
4648
-  echo 'nameserver 213.73.91.35' >> /etc/resolv.conf
4649
-  echo 'nameserver 85.214.20.141' >> /etc/resolv.conf
4670
+  echo "nameserver $NAMESERVER1" >> /etc/resolv.conf
4671
+  echo "nameserver $NAMESERVER2" >> /etc/resolv.conf
4650
   echo 'configure_dns' >> $COMPLETION_FILE
4672
   echo 'configure_dns' >> $COMPLETION_FILE
4651
 }
4673
 }
4652
 
4674