ソースを参照

Change location of resolv.conf

Bob Mottram 7 年 前
コミット
a6cbf0dc65
共有6 個のファイルを変更した38 個の追加22 個の削除を含む
  1. 12
    2
      src/freedombone-image-customise
  2. 1
    1
      src/freedombone-utils-config
  3. 12
    10
      src/freedombone-utils-dns
  4. 10
    7
      src/freedombone-utils-onion
  5. 1
    1
      src/freedombone-utils-setup
  6. 2
    1
      src/freedombone-utils-wifi

+ 12
- 2
src/freedombone-image-customise ファイルの表示

239
             $rootdir/etc/network/interfaces
239
             $rootdir/etc/network/interfaces
240
     fi
240
     fi
241
 
241
 
242
-    sed -i "s/nameserver.*/nameserver $NAMESERVER1/g" $rootdir/etc/resolv.conf
243
-    sed -i "/nameserver $NAMESERVER1/a\nameserver $NAMESERVER2" $rootdir/etc/resolv.conf
242
+    # configure DNS
243
+    resolvconf=$rootdir/var/run/NetworkManager/resolv.conf
244
+    chattr -i $resolvconf
245
+    echo 'domain localdomain' > $resolvconf
246
+    echo 'search localdomain' >> $resolvconf
247
+    echo "nameserver $NAMESERVER1" >> $resolvconf
248
+    echo "nameserver $NAMESERVER2" >> $resolvconf
249
+    echo "nameserver $NAMESERVER3" >> $resolvconf
250
+    echo "nameserver $NAMESERVER4" >> $resolvconf
251
+    echo "nameserver $NAMESERVER5" >> $resolvconf
252
+    echo "nameserver $NAMESERVER6" >> $resolvconf
253
+    chattr +i $resolvconf
244
 
254
 
245
     if [[ $VARIANT != "meshclient" && $VARIANT != "meshusb" ]]; then
255
     if [[ $VARIANT != "meshclient" && $VARIANT != "meshusb" ]]; then
246
         # change the motd to show further install instructions
256
         # change the motd to show further install instructions

+ 1
- 1
src/freedombone-utils-config ファイルの表示

315
 
315
 
316
         if grep -q "DEBIAN_REPO" $CONFIGURATION_FILE; then
316
         if grep -q "DEBIAN_REPO" $CONFIGURATION_FILE; then
317
             read_config_param "DEBIAN_REPO"
317
             read_config_param "DEBIAN_REPO"
318
-            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."
318
+            CHECK_MESSAGE=$"Check your internet connection, /etc/network/interfaces and /var/run/NetworkManager/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."
319
         fi
319
         fi
320
     fi
320
     fi
321
 }
321
 }

+ 12
- 10
src/freedombone-utils-dns ファイルの表示

196
         return
196
         return
197
     fi
197
     fi
198
 
198
 
199
+    resolvconf=/var/run/NetworkManager/resolv.conf
200
+
199
     # allow changes to resolv.conf
201
     # allow changes to resolv.conf
200
-    chattr -i /etc/resolv.conf
202
+    chattr -i $resolvconf
201
 
203
 
202
-    echo 'domain localdomain' > /etc/resolv.conf
203
-    echo 'search localdomain' >> /etc/resolv.conf
204
-    echo "nameserver $NAMESERVER1" >> /etc/resolv.conf
205
-    echo "nameserver $NAMESERVER2" >> /etc/resolv.conf
206
-    echo "nameserver $NAMESERVER3" >> /etc/resolv.conf
207
-    echo "nameserver $NAMESERVER4" >> /etc/resolv.conf
208
-    echo "nameserver $NAMESERVER5" >> /etc/resolv.conf
209
-    echo "nameserver $NAMESERVER6" >> /etc/resolv.conf
204
+    echo 'domain localdomain' > $resolvconf
205
+    echo 'search localdomain' >> $resolvconf
206
+    echo "nameserver $NAMESERVER1" >> $resolvconf
207
+    echo "nameserver $NAMESERVER2" >> $resolvconf
208
+    echo "nameserver $NAMESERVER3" >> $resolvconf
209
+    echo "nameserver $NAMESERVER4" >> $resolvconf
210
+    echo "nameserver $NAMESERVER5" >> $resolvconf
211
+    echo "nameserver $NAMESERVER6" >> $resolvconf
210
 
212
 
211
     # prevent resolv.conf from changing
213
     # prevent resolv.conf from changing
212
-    chattr +i /etc/resolv.conf
214
+    chattr +i $resolvconf
213
 
215
 
214
     mark_completed $FUNCNAME
216
     mark_completed $FUNCNAME
215
 }
217
 }

+ 10
- 7
src/freedombone-utils-onion ファイルの表示

318
     sed -i 's|, domain-name-servers||g' /etc/dhcp/dhclient.conf
318
     sed -i 's|, domain-name-servers||g' /etc/dhcp/dhclient.conf
319
 
319
 
320
     # point resolv.conf to tor
320
     # point resolv.conf to tor
321
-    echo 'nameserver 127.0.0.1:53' > /etc/resolv.conf
322
-
323
-    # prevent resolv.conf from changing
324
-    chattr +i /etc/resolv.conf
321
+    resolvconf=/var/run/NetworkManager/resolv.conf
322
+    chattr -i $resolvconf
323
+    echo 'nameserver 127.0.0.1:53' > $resolvconf
324
+    chattr +i $resolvconf
325
 
325
 
326
     mark_completed $FUNCNAME
326
     mark_completed $FUNCNAME
327
 }
327
 }
386
         /sbin/sysctl -p -q
386
         /sbin/sysctl -p -q
387
     fi
387
     fi
388
 
388
 
389
-    echo 'domain localdomain' > /etc/resolv.conf
390
-    echo 'search localdomain' >> /etc/resolv.conf
391
-    echo 'nameserver 127.0.0.1' >> /etc/resolv.conf
389
+    resolvconf=/var/run/NetworkManager/resolv.conf
390
+    chattr -i $resolvconf
391
+    echo 'domain localdomain' > $resolvconf
392
+    echo 'search localdomain' >> $resolvconf
393
+    echo 'nameserver 127.0.0.1' >> $resolvconf
394
+    chattr +i $resolvconf
392
 
395
 
393
     if ! grep -q "VirtualAddrNetworkIPv4" /etc/tor/torrc; then
396
     if ! grep -q "VirtualAddrNetworkIPv4" /etc/tor/torrc; then
394
         echo 'VirtualAddrNetworkIPv4 10.192.0.0/10' >> /etc/tor/torrc
397
         echo 'VirtualAddrNetworkIPv4 10.192.0.0/10' >> /etc/tor/torrc

+ 1
- 1
src/freedombone-utils-setup ファイルの表示

76
 REMOTE_BACKUPS_LOG=/var/log/remotebackups.log
76
 REMOTE_BACKUPS_LOG=/var/log/remotebackups.log
77
 
77
 
78
 # message if something fails to install
78
 # message if something fails to install
79
-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."
79
+CHECK_MESSAGE="Check your internet connection, /etc/network/interfaces and /var/run/NetworkManager/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."
80
 
80
 
81
 # Default diffie-hellman key length in bits
81
 # Default diffie-hellman key length in bits
82
 DH_KEYLENGTH=2048
82
 DH_KEYLENGTH=2048

+ 2
- 1
src/freedombone-utils-wifi ファイルの表示

447
         fi
447
         fi
448
     done < $WIFI_NETWORKS_FILE
448
     done < $WIFI_NETWORKS_FILE
449
 
449
 
450
-    chattr -i /etc/resolv.conf
450
+    resolvconf=/var/run/NetworkManager/resolv.conf
451
+    chattr -i $resolvconf
451
     systemctl restart network-manager
452
     systemctl restart network-manager
452
     ifconfig ${WIFI_INTERFACE} up
453
     ifconfig ${WIFI_INTERFACE} up
453
 }
454
 }