|
@@ -1335,8 +1335,15 @@ Enter a static local IP address for this system.\n\nIt will typically be 192.168
|
1335
|
1335
|
;;
|
1336
|
1336
|
esac
|
1337
|
1337
|
|
1338
|
|
- if ! grep -q 'iface eth0 inet static' /etc/network/interfaces; then
|
1339
|
|
- if [[ "$NEW_STATIC_GATEWAY" == *"."* && "$NEW_STATIC_IP" == *"."* ]]; then
|
|
1338
|
+ if [[ "$NEW_STATIC_GATEWAY" == *"."* && "$NEW_STATIC_IP" == *"."* ]]; then
|
|
1339
|
+ ip_addresses_have_changed=
|
|
1340
|
+ if ! grep -q "address ${NEW_STATIC_IP}" /etc/network/interfaces; then
|
|
1341
|
+ ip_addresses_have_changed=1
|
|
1342
|
+ fi
|
|
1343
|
+ if ! grep -q "gateway ${NEW_STATIC_GATEWAY}" /etc/network/interfaces; then
|
|
1344
|
+ ip_addresses_have_changed=1
|
|
1345
|
+ fi
|
|
1346
|
+ if [ $ip_addresses_have_changed ]; then
|
1340
|
1347
|
echo '# This file describes the network interfaces available on your system' > /etc/network/interfaces
|
1341
|
1348
|
echo '# and how to activate them. For more information, see interfaces(5).' >> /etc/network/interfaces
|
1342
|
1349
|
echo '' >> /etc/network/interfaces
|
|
@@ -1372,12 +1379,26 @@ Enter a static local IP address for this system.\n\nIt will typically be 192.168
|
1372
|
1379
|
echo '# netmask 255.255.255.0' >> /etc/network/interfaces
|
1373
|
1380
|
echo '# network 192.168.7.0' >> /etc/network/interfaces
|
1374
|
1381
|
echo '# gateway 192.168.7.1' >> /etc/network/interfaces
|
1375
|
|
- fi
|
1376
|
1382
|
|
1377
|
|
- # if pi-hole is installed then update the IP address it uses
|
1378
|
|
- if [ -f /usr/local/bin/pihole ]; then
|
1379
|
|
- function_check pihole_update
|
1380
|
|
- pihole_update
|
|
1383
|
+ pihole_change_ipv4 ${NEW_STATIC_IP}
|
|
1384
|
+
|
|
1385
|
+ systemctl restart networking
|
|
1386
|
+
|
|
1387
|
+ # see if the IP address has changed
|
|
1388
|
+ IPv4_address=$(get_ipv4_address)
|
|
1389
|
+ if [[ "$IPv4_address" == "${NEW_STATIC_IP}"* ]]; then
|
|
1390
|
+ dialog --title $"Static local IP address" \
|
|
1391
|
+ --msgbox $"The IP address of this system is now set to ${NEW_STATIC_IP}" 6 50
|
|
1392
|
+ else
|
|
1393
|
+ dialog --title $"Static local IP address" \
|
|
1394
|
+ --backtitle $"Freedombone Control Panel" \
|
|
1395
|
+ --defaultno \
|
|
1396
|
+ --yesno $"\nFor the change to take effect your system will now need to reboot. Do this now?" 8 60
|
|
1397
|
+ sel=$?
|
|
1398
|
+ case $sel in
|
|
1399
|
+ 0) reboot;;
|
|
1400
|
+ esac
|
|
1401
|
+ fi
|
1381
|
1402
|
fi
|
1382
|
1403
|
fi
|
1383
|
1404
|
}
|