From 34003a4de82610dfbd4e31fe42f16ccddaccf920 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Thu, 22 Jun 2017 20:28:01 +0100 Subject: [PATCH] Transition to network manager interfaces directory --- src/freedombone-controlpanel | 65 +++++-------- src/freedombone-image-customise | 57 ++++-------- src/freedombone-utils-network | 41 ++------ src/freedombone-utils-wifi | 159 ++++++++++++++++++-------------- 4 files changed, 134 insertions(+), 188 deletions(-) diff --git a/src/freedombone-controlpanel b/src/freedombone-controlpanel index f48eb566..cde1b6f4 100755 --- a/src/freedombone-controlpanel +++ b/src/freedombone-controlpanel @@ -1441,9 +1441,9 @@ function set_static_IP { NEW_STATIC_IP= NEW_STATIC_GATEWAY= - if grep -q 'iface eth0 inet static' /etc/network/interfaces; then - STATIC_IP=$(cat /etc/network/interfaces | grep "address " | head -n 1 | awk -F ' ' '{print $2}') - STATIC_GATEWAY=$(cat /etc/network/interfaces | grep "gateway " | head -n 1 | awk -F ' ' '{print $2}') + if [ -f /etc/network/interfaces.d/static ]; then + STATIC_IP=$(cat /etc/network/interfaces.d/static | grep "address " | head -n 1 | awk -F ' ' '{print $2}') + STATIC_GATEWAY=$(cat /etc/network/interfaces.d/static | grep "gateway " | head -n 1 | awk -F ' ' '{print $2}') fi # get the IP for the box @@ -1482,11 +1482,13 @@ Enter a static local IP address for this system.\n\nIt will typically be ${IPv4_ if [[ "$NEW_STATIC_GATEWAY" == *"."* && "$NEW_STATIC_IP" == *"."* ]]; then ip_addresses_have_changed= - if ! grep -q "address ${NEW_STATIC_IP}" /etc/network/interfaces; then - ip_addresses_have_changed=1 - fi - if ! grep -q "gateway ${NEW_STATIC_GATEWAY}" /etc/network/interfaces; then - ip_addresses_have_changed=1 + if [ -f /etc/network/interfaces.d/static ]; then + if ! grep -q "address ${NEW_STATIC_IP}" /etc/network/interfaces.d/static; then + ip_addresses_have_changed=1 + fi + if ! grep -q "gateway ${NEW_STATIC_GATEWAY}" /etc/network/interfaces.d/static; then + ip_addresses_have_changed=1 + fi fi if [ $ip_addresses_have_changed ]; then write_config_param "NETWORK_IS_STATIC" "1" @@ -1508,44 +1510,19 @@ Enter a static local IP address for this system.\n\nIt will typically be ${IPv4_ esac fi + echo '# This file describes the network interfaces available on your system' > /etc/network/interfaces + echo '# and how to activate them. For more information, see interfaces(5).' >> /etc/network/interfaces + echo 'source /etc/network/interfaces.d/*' >> /etc/network/interfaces + if [ ! $static_wifi_address ]; then # wired network remove_wifi_startup_script - echo '# This file describes the network interfaces available on your system' > /etc/network/interfaces - echo '# and how to activate them. For more information, see interfaces(5).' >> /etc/network/interfaces - echo '' >> /etc/network/interfaces - echo '# The loopback network interface' >> /etc/network/interfaces - echo 'auto lo' >> /etc/network/interfaces - echo 'iface lo inet loopback' >> /etc/network/interfaces - echo '' >> /etc/network/interfaces - echo '# The primary network interface' >> /etc/network/interfaces - echo 'auto eth0' >> /etc/network/interfaces - echo 'iface eth0 inet static' >> /etc/network/interfaces - echo " address ${NEW_STATIC_IP}" >> /etc/network/interfaces - echo ' netmask 255.255.255.0' >> /etc/network/interfaces - echo " gateway ${NEW_STATIC_GATEWAY}" >> /etc/network/interfaces - echo " dns-nameservers 213.73.91.35 85.214.20.141" >> /etc/network/interfaces - echo '# Example to keep MAC address between reboots' >> /etc/network/interfaces - echo '#hwaddress ether DE:AD:BE:EF:CA:FE' >> /etc/network/interfaces - echo '' >> /etc/network/interfaces - echo '# The secondary network interface' >> /etc/network/interfaces - echo '#auto eth1' >> /etc/network/interfaces - echo '#iface eth1 inet dhcp' >> /etc/network/interfaces - echo '' >> /etc/network/interfaces - echo '# WiFi Example' >> /etc/network/interfaces - echo "#auto $WIFI_INTERFACE" >> /etc/network/interfaces - echo "#iface $WIFI_INTERFACE inet dhcp" >> /etc/network/interfaces - echo '# wpa-ssid "essid"' >> /etc/network/interfaces - echo '# wpa-psk "password"' >> /etc/network/interfaces - echo '' >> /etc/network/interfaces - echo '# Ethernet/RNDIS gadget (g_ether)' >> /etc/network/interfaces - echo '# ... or on host side, usbnet and random hwaddr' >> /etc/network/interfaces - echo '# Note on some boards, usb0 is automaticly setup with an init script' >> /etc/network/interfaces - echo '#iface usb0 inet static' >> /etc/network/interfaces - echo '# address 192.168.7.2' >> /etc/network/interfaces - echo '# netmask 255.255.255.0' >> /etc/network/interfaces - echo '# network 192.168.7.0' >> /etc/network/interfaces - echo '# gateway 192.168.7.1' >> /etc/network/interfaces + + echo 'auto eth0' > /etc/network/interfaces.d/static + echo 'iface eth0 inet static' >> /etc/network/interfaces.d/static + echo " address ${NEW_STATIC_IP}" >> /etc/network/interfaces.d/static + echo ' netmask 255.255.255.0' >> /etc/network/interfaces.d/static + echo " gateway ${NEW_STATIC_GATEWAY}" >> /etc/network/interfaces.d/static else # wifi network wifi_settings @@ -2036,7 +2013,7 @@ function menu_wifi { if [ -f /etc/hostapd/hostapd.conf ]; then status_str=$'Hotspot ON' else - if grep -q "# wifi enabled" /etc/network/interfaces; then + if [ -f /etc/network/interfaces.d/wifi ]; then status_str=$'Wifi ON' fi fi diff --git a/src/freedombone-image-customise b/src/freedombone-image-customise index 63c7c441..61dd310a 100755 --- a/src/freedombone-image-customise +++ b/src/freedombone-image-customise @@ -183,14 +183,16 @@ configure_networking() { if [[ "$MACHINE" == "beaglebonewifi" ]]; then # Allow networking over USB in order to configure the # wifi login settings - echo 'auto lo' > $rootdir/etc/network/interfaces - echo 'iface lo inet loopback' >> $rootdir/etc/network/interfaces - echo '' >> $rootdir/etc/network/interfaces - echo 'iface usb0 inet static' >> $rootdir/etc/network/interfaces - echo ' address 192.168.7.2' >> $rootdir/etc/network/interfaces - echo ' netmask 255.255.255.252' >> $rootdir/etc/network/interfaces - echo ' network 192.168.7.0' >> $rootdir/etc/network/interfaces - echo ' gateway 192.168.7.1' >> $rootdir/etc/network/interfaces + + echo '# This file describes the network interfaces available on your system' > $rootdir/etc/network/interfaces + echo '# and how to activate them. For more information, see interfaces(5).' >> $rootdir/etc/network/interfaces + echo 'source /etc/network/interfaces.d/*' >> $rootdir/etc/network/interfaces + + echo 'iface usb0 inet static' >> $rootdir/etc/network/interfaces.d/usb + echo ' address 192.168.7.2' >> $rootdir/etc/network/interfaces.d/usb + echo ' netmask 255.255.255.252' >> $rootdir/etc/network/interfaces.d/usb + echo ' network 192.168.7.0' >> $rootdir/etc/network/interfaces.d/usb + echo ' gateway 192.168.7.1' >> $rootdir/etc/network/interfaces.d/usb return fi @@ -199,41 +201,15 @@ configure_networking() { fi if [[ $GENERIC_IMAGE == "no" ]]; then - echo "# This file describes the network interfaces available on your system -# and how to activate them. For more information, see interfaces(5). + echo '# This file describes the network interfaces available on your system' > $rootdir/etc/network/interfaces + echo '# and how to activate them. For more information, see interfaces(5).' >> $rootdir/etc/network/interfaces + echo 'source /etc/network/interfaces.d/*' >> $rootdir/etc/network/interfaces -# The loopback network interface -auto lo -iface lo inet loopback - -# The primary network interface -auto eth0 + echo "auto eth0 iface eth0 inet static address $BOX_IP_ADDRESS netmask 255.255.255.0 - gateway $ROUTER_IP_ADDRESS - dns-nameservers $NAMESERVER1 $NAMESERVER2 - # Example to keep MAC address between reboots - #hwaddress ether B5:A2:BE:3F:1A:FE - - # The secondary network interface - #auto eth1 - #iface eth1 inet dhcp - - # WiFi Example - #auto wlan0 - #iface wlan0 inet dhcp - # wpa-ssid \"essid\" - # wpa-psk \"password\" - - # Ethernet/RNDIS gadget (g_ether) - # ... or on host side, usbnet and random hwaddr - # Note on some boards, usb0 is automaticly setup with an init script - #iface usb0 inet static - # address 192.168.7.2 - # netmask 255.255.255.0 - # network 192.168.7.0 - # gateway 192.168.7.1" > $rootdir/etc/network/interfaces + gateway $ROUTER_IP_ADDRESS" > $rootdir/etc/network/interfaces.d/static hexarray=( 1 2 3 4 5 6 7 8 9 0 a b c d e f ) a=${hexarray[$RANDOM%16]}${hexarray[$RANDOM%16]} @@ -241,8 +217,7 @@ iface eth0 inet static c=${hexarray[$RANDOM%16]}${hexarray[$RANDOM%16]} d=${hexarray[$RANDOM%16]}${hexarray[$RANDOM%16]} e=${hexarray[$RANDOM%16]}${hexarray[$RANDOM%16]} - sed -i "s|#hwaddress ether.*|hwaddress ether de:$a:$b:$c:$d:$e|g" \ - $rootdir/etc/network/interfaces + echo "hwaddress ether de:$a:$b:$c:$d:$e" > $rootdir/etc/network/interfaces.d/macaddress fi # configure DNS diff --git a/src/freedombone-utils-network b/src/freedombone-utils-network index 929cdf35..2befcc1a 100755 --- a/src/freedombone-utils-network +++ b/src/freedombone-utils-network @@ -51,38 +51,15 @@ function install_static_network { return fi - echo '# The loopback network interface' > /etc/network/interfaces - echo 'auto lo' >> /etc/network/interfaces - echo 'iface lo inet loopback' >> /etc/network/interfaces - echo '' >> /etc/network/interfaces - echo '# The primary network interface' >> /etc/network/interfaces - echo 'auto eth0' >> /etc/network/interfaces - echo 'iface eth0 inet static' >> /etc/network/interfaces - echo " address $LOCAL_NETWORK_STATIC_IP_ADDRESS" >> /etc/network/interfaces - echo ' netmask 255.255.255.0' >> /etc/network/interfaces - echo " gateway $ROUTER_IP_ADDRESS" >> /etc/network/interfaces - echo " dns-nameservers $NAMESERVER1 $NAMESERVER2 $NAMESERVER3 $NAMESERVER4 $NAMESERVER5 $NAMESERVER6" >> /etc/network/interfaces - echo '# Example to keep MAC address between reboots' >> /etc/network/interfaces - echo '#hwaddress ether DE:AD:BE:EF:CA:FE' >> /etc/network/interfaces - echo '' >> /etc/network/interfaces - echo '# The secondary network interface' >> /etc/network/interfaces - echo '#auto eth1' >> /etc/network/interfaces - echo '#iface eth1 inet dhcp' >> /etc/network/interfaces - echo '' >> /etc/network/interfaces - echo '# WiFi Example' >> /etc/network/interfaces - echo "#auto $WIFI_INTERFACE" >> /etc/network/interfaces - echo "#iface $WIFI_INTERFACE inet dhcp" >> /etc/network/interfaces - echo '# wpa-ssid "essid"' >> /etc/network/interfaces - echo '# wpa-psk "password"' >> /etc/network/interfaces - echo '' >> /etc/network/interfaces - echo '# Ethernet/RNDIS gadget (g_ether)' >> /etc/network/interfaces - echo '# ... or on host side, usbnet and random hwaddr' >> /etc/network/interfaces - echo '# Note on some boards, usb0 is automaticly setup with an init script' >> /etc/network/interfaces - echo '#iface usb0 inet static' >> /etc/network/interfaces - echo '# address 192.168.7.2' >> /etc/network/interfaces - echo '# netmask 255.255.255.0' >> /etc/network/interfaces - echo '# network 192.168.7.0' >> /etc/network/interfaces - echo '# gateway 192.168.7.1' >> /etc/network/interfaces + echo '# This file describes the network interfaces available on your system' > /etc/network/interfaces + echo '# and how to activate them. For more information, see interfaces(5).' >> /etc/network/interfaces + echo 'source /etc/network/interfaces.d/*' >> /etc/network/interfaces + + echo 'auto eth0' > /etc/network/interfaces.d/static + echo 'iface eth0 inet static' >> /etc/network/interfaces.d/static + echo " address $LOCAL_NETWORK_STATIC_IP_ADDRESS" >> /etc/network/interfaces.d/static + echo ' netmask 255.255.255.0' >> /etc/network/interfaces.d/static + echo " gateway $ROUTER_IP_ADDRESS" >> /etc/network/interfaces.d/static mark_completed $FUNCNAME } diff --git a/src/freedombone-utils-wifi b/src/freedombone-utils-wifi index 4f9e797d..4a01714e 100755 --- a/src/freedombone-utils-wifi +++ b/src/freedombone-utils-wifi @@ -39,6 +39,12 @@ WIFI_NETWORKS_FILE=~/${PROJECT_NAME}-wifi.cfg # repo for atheros AR9271 wifi driver ATHEROS_WIFI_REPO="https://github.com/qca/open-ath9k-htc-firmware.git" +function default_network_config { + echo '# This file describes the network interfaces available on your system' > /etc/network/interfaces + echo '# and how to activate them. For more information, see interfaces(5).' >> /etc/network/interfaces + echo 'source /etc/network/interfaces.d/*' >> /etc/network/interfaces +} + # Debian stretch has a problem where the formerly predictable wlan0 and eth0 # device names get assigned random names. This is a hacky workaround. # Also adding net.ifnames=0 to kernel options on bootloader may work. @@ -65,16 +71,15 @@ function wifi_static_network_interface { NETWORK_IS_STATIC=0 read_config_param "NETWORK_IS_STATIC" if [ ${NETWORK_IS_STATIC} -eq 0 ]; then - echo '#this line must always be here' >> /etc/network/interfaces - echo 'iface default inet dhcp' >> /etc/network/interfaces + echo '#this line must always be here' > /etc/network/interfaces.d/static + echo 'iface default inet dhcp' >> /etc/network/interfaces.d/static else read_config_param "LOCAL_NETWORK_STATIC_IP_ADDRESS" read_config_param "ROUTER_IP_ADDRESS" - echo '#static address' >> /etc/network/interfaces - echo 'iface default inet static' >> /etc/network/interfaces - echo " address ${LOCAL_NETWORK_STATIC_IP_ADDRESS}" >> /etc/network/interfaces - echo ' netmask 255.255.255.0' >> /etc/network/interfaces - echo " gateway ${ROUTER_IP_ADDRESS}" >> /etc/network/interfaces + echo 'iface default inet static' > /etc/network/interfaces.d/static + echo " address ${LOCAL_NETWORK_STATIC_IP_ADDRESS}" >> /etc/network/interfaces.d/static + echo ' netmask 255.255.255.0' >> /etc/network/interfaces.d/static + echo " gateway ${ROUTER_IP_ADDRESS}" >> /etc/network/interfaces.d/static fi } @@ -240,13 +245,25 @@ function hotspot_off { rm /etc/hostapd/hostapd.conf - if [ -f /etc/network/interfaces_original ]; then - cp /etc/network/interfaces_original /etc/network/interfaces + if [ -f /etc/network/interfaces_original_static ]; then + cp /etc/network/interfaces_original_static /etc/network/interfaces.d/static else - echo '# interfaces(5) file used by ifup(8) and ifdown(8)' > /etc/network/interfaces - echo '# Include files from /etc/network/interfaces.d:' >> /etc/network/interfaces - echo 'source-directory /etc/network/interfaces.d' >> /etc/network/interfaces + if [ -f /etc/network/interfaces.d/static ]; then + rm /etc/network/interfaces.d/static + fi fi + if [ -f /etc/network/interfaces_original_wifi ]; then + cp /etc/network/interfaces_original_wifi /etc/network/interfaces.d/wifi + else + if [ -f /etc/network/interfaces.d/wifi ]; then + rm /etc/network/interfaces.d/wifi + fi + fi + if [ -f /etc/network/interfaces.d/bridge ]; then + rm /etc/network/interfaces.d/bridge + fi + + default_network_config wpa_action ${WIFI_INTERFACE} stop wpa_cli -i ${WIFI_INTERFACE} terminate @@ -294,30 +311,29 @@ function hotspot_on { echo '## Accept all MAC address ###' >> /etc/hostapd/hostapd.conf echo 'macaddr_acl=0' >> /etc/hostapd/hostapd.conf - if [ ! -f /etc/network/interfaces_original ]; then - if ! grep -q "# wifi enabled" /etc/network/interfaces; then - cp /etc/network/interfaces /etc/network/interfaces_original + if [ ! -f /etc/network/interfaces_original_static ]; then + if [ -f /etc/network/interfaces.d/static ]; then + cp /etc/network/interfaces.d/static /etc/network/interfaces_original_static + fi + fi + if [ ! -f /etc/network/interfaces_original_wifi ]; then + if [ -f /etc/network/interfaces.d/wifi ]; then + cp /etc/network/interfaces.d/wifi /etc/network/interfaces_original_wifi fi fi - echo '# wifi enabled' > /etc/network/interfaces - echo 'auto lo br0' >> /etc/network/interfaces - echo 'iface lo inet loopback' >> /etc/network/interfaces - echo '' >> /etc/network/interfaces - echo "# wireless $WIFI_INTERFACE" >> /etc/network/interfaces - echo "allow-hotplug $WIFI_INTERFACE" >> /etc/network/interfaces - echo "iface $WIFI_INTERFACE inet manual" >> /etc/network/interfaces - echo '' >> /etc/network/interfaces - echo '# eth0 connected to the ISP router' >> /etc/network/interfaces - echo 'allow-hotplug eth0' >> /etc/network/interfaces - echo 'iface eth0 inet manual' >> /etc/network/interfaces - echo '' >> /etc/network/interfaces - echo '# Setup bridge' >> /etc/network/interfaces - echo 'iface br0 inet static' >> /etc/network/interfaces - echo " bridge_ports $WIFI_INTERFACE eth0" >> /etc/network/interfaces + default_network_config + + echo "allow-hotplug $WIFI_INTERFACE" > /etc/network/interfaces.d/wifi + echo "iface $WIFI_INTERFACE inet manual" >> /etc/network/interfaces.d/wifi + + echo 'allow-hotplug eth0' >> /etc/network/interfaces.d/static + echo 'iface eth0 inet manual' >> /etc/network/interfaces.d/static + + echo 'iface br0 inet static' >> /etc/network/interfaces.d/bridge + echo " bridge_ports $WIFI_INTERFACE eth0" >> /etc/network/interfaces.d/bridge systemctl restart network-manager - #ifconfig $WIFI_INTERFACE up ifup $WIFI_INTERFACE systemctl restart hostapd } @@ -332,8 +348,14 @@ function wifi_store_original_network_settings { function wifi_original_network_settings { remove_config_param "NETWORK_IS_STATIC" - if [ -f /etc/network/interfaces_original ]; then - cp /etc/network/interfaces_original /etc/network/interfaces + if [ -f /etc/network/interfaces.d/static ]; then + rm /etc/network/interfaces.d/static + fi + if [ -f /etc/network/interfaces.d/wifi ]; then + rm /etc/network/interfaces.d/wifi + fi + if [ -f /etc/network/interfaces.d/bridge ]; then + rm /etc/network/interfaces.d/bridge fi } @@ -343,23 +365,17 @@ function wifi_wpa2_psk { wifi_store_original_network_settings - echo '# wifi enabled' > /etc/network/interfaces - echo 'auto lo' >> /etc/network/interfaces - echo 'iface lo inet loopback' >> /etc/network/interfaces - echo '' >> /etc/network/interfaces - echo 'allow-hotplug eth0' >> /etc/network/interfaces - echo 'iface eth0 inet dhcp' >> /etc/network/interfaces - echo '' >> /etc/network/interfaces - echo "allow-hotplug ${WIFI_INTERFACE}" >> /etc/network/interfaces - echo "iface ${WIFI_INTERFACE} inet manual" >> /etc/network/interfaces - echo " wpa-roam $WIFI_CONFIG" >> /etc/network/interfaces - echo '' >> /etc/network/interfaces + echo 'allow-hotplug eth0' > /etc/network/interfaces.d/static + echo 'iface eth0 inet dhcp' >> /etc/network/interfaces.d/static + + echo "allow-hotplug ${WIFI_INTERFACE}" > /etc/network/interfaces.d/wifi + echo "iface ${WIFI_INTERFACE} inet manual" >> /etc/network/interfaces.d/wifi + echo " wpa-roam $WIFI_CONFIG" >> /etc/network/interfaces.d/wifi wifi_static_network_interface wpa_passphrase "$ssid" "$passphrase" > $WIFI_CONFIG systemctl restart network-manager - #ifconfig ${WIFI_INTERFACE} up ifup $WIFI_INTERFACE } @@ -368,17 +384,13 @@ function wifi_none { wifi_store_original_network_settings - echo '# wifi enabled' > /etc/network/interfaces - echo 'auto lo' >> /etc/network/interfaces - echo 'iface lo inet loopback' >> /etc/network/interfaces - echo '' >> /etc/network/interfaces - echo 'allow-hotplug eth0' >> /etc/network/interfaces - echo 'iface eth0 inet dhcp' >> /etc/network/interfaces - echo '' >> /etc/network/interfaces - echo "allow-hotplug ${WIFI_INTERFACE}" >> /etc/network/interfaces - echo "iface ${WIFI_INTERFACE} inet manual" >> /etc/network/interfaces - echo " wpa-roam $WIFI_CONFIG" >> /etc/network/interfaces - echo '' >> /etc/network/interfaces + echo 'allow-hotplug eth0' > /etc/network/interfaces.d/static + echo 'iface eth0 inet dhcp' >> /etc/network/interfaces.d/static + + echo "allow-hotplug ${WIFI_INTERFACE}" > /etc/network/interfaces.d/wifi + echo "iface ${WIFI_INTERFACE} inet manual" >> /etc/network/interfaces.d/wifi + echo " wpa-roam $WIFI_CONFIG" >> /etc/network/interfaces.d/wifi + wifi_static_network_interface echo 'ctrl_interface=/run/wpa_supplicant' > $WIFI_CONFIG @@ -394,7 +406,6 @@ function wifi_none { echo '}' >> $WIFI_CONFIG systemctl restart network-manager - #ifconfig ${WIFI_INTERFACE} up ifup $WIFI_INTERFACE } @@ -410,17 +421,13 @@ function networks_from_file { wifi_store_original_network_settings - echo '# wifi enabled' > /etc/network/interfaces - echo 'auto lo' >> /etc/network/interfaces - echo 'iface lo inet loopback' >> /etc/network/interfaces - echo '' >> /etc/network/interfaces - echo 'allow-hotplug eth0' >> /etc/network/interfaces - echo 'iface eth0 inet dhcp' >> /etc/network/interfaces - echo '' >> /etc/network/interfaces - echo "allow-hotplug ${WIFI_INTERFACE}" >> /etc/network/interfaces - echo "iface ${WIFI_INTERFACE} inet manual" >> /etc/network/interfaces - echo " wpa-roam $WIFI_CONFIG" >> /etc/network/interfaces - echo '' >> /etc/network/interfaces + echo 'allow-hotplug eth0' > /etc/network/interfaces.d/static + echo 'iface eth0 inet dhcp' >> /etc/network/interfaces.d/static + + echo "allow-hotplug ${WIFI_INTERFACE}" >> /etc/network/interfaces.d/wifi + echo "iface ${WIFI_INTERFACE} inet manual" >> /etc/network/interfaces.d/wifi + echo " wpa-roam $WIFI_CONFIG" >> /etc/network/interfaces.d/wifi + wifi_static_network_interface # remove wpa_supplicant.conf if it exists @@ -577,9 +584,19 @@ function create_networks_interactive { function disable_wifi { if [[ ${1} == 'yes' || ${1} == 'y' ]]; then hotspot_off - echo '# interfaces(5) file used by ifup(8) and ifdown(8)' > /etc/network/interfaces - echo '# Include files from /etc/network/interfaces.d:' >> /etc/network/interfaces - echo 'source-directory /etc/network/interfaces.d' >> /etc/network/interfaces + + if [ -f /etc/network/interfaces.d/static ]; then + rm /etc/network/interfaces.d/static + fi + if [ -f /etc/network/interfaces.d/wifi ]; then + rm /etc/network/interfaces.d/wifi + fi + if [ -f /etc/network/interfaces.d/bridge ]; then + rm /etc/network/interfaces.d/bridge + fi + + default_network_config + remove_config_param "WIFI_INTERFACE" wpa_action ${WIFI_INTERFACE} stop wpa_cli -i ${WIFI_INTERFACE} terminate