Transition to network manager interfaces directory
This commit is contained in:
parent
9d4858c07e
commit
34003a4de8
|
@ -1441,9 +1441,9 @@ function set_static_IP {
|
||||||
|
|
||||||
NEW_STATIC_IP=
|
NEW_STATIC_IP=
|
||||||
NEW_STATIC_GATEWAY=
|
NEW_STATIC_GATEWAY=
|
||||||
if grep -q 'iface eth0 inet static' /etc/network/interfaces; then
|
if [ -f /etc/network/interfaces.d/static ]; then
|
||||||
STATIC_IP=$(cat /etc/network/interfaces | grep "address " | head -n 1 | awk -F ' ' '{print $2}')
|
STATIC_IP=$(cat /etc/network/interfaces.d/static | grep "address " | head -n 1 | awk -F ' ' '{print $2}')
|
||||||
STATIC_GATEWAY=$(cat /etc/network/interfaces | grep "gateway " | 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
|
fi
|
||||||
|
|
||||||
# get the IP for the box
|
# get the IP for the box
|
||||||
|
@ -1482,12 +1482,14 @@ Enter a static local IP address for this system.\n\nIt will typically be ${IPv4_
|
||||||
|
|
||||||
if [[ "$NEW_STATIC_GATEWAY" == *"."* && "$NEW_STATIC_IP" == *"."* ]]; then
|
if [[ "$NEW_STATIC_GATEWAY" == *"."* && "$NEW_STATIC_IP" == *"."* ]]; then
|
||||||
ip_addresses_have_changed=
|
ip_addresses_have_changed=
|
||||||
if ! grep -q "address ${NEW_STATIC_IP}" /etc/network/interfaces; then
|
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
|
ip_addresses_have_changed=1
|
||||||
fi
|
fi
|
||||||
if ! grep -q "gateway ${NEW_STATIC_GATEWAY}" /etc/network/interfaces; then
|
if ! grep -q "gateway ${NEW_STATIC_GATEWAY}" /etc/network/interfaces.d/static; then
|
||||||
ip_addresses_have_changed=1
|
ip_addresses_have_changed=1
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
if [ $ip_addresses_have_changed ]; then
|
if [ $ip_addresses_have_changed ]; then
|
||||||
write_config_param "NETWORK_IS_STATIC" "1"
|
write_config_param "NETWORK_IS_STATIC" "1"
|
||||||
write_config_param "LOCAL_NETWORK_STATIC_IP_ADDRESS" "$NEW_STATIC_IP"
|
write_config_param "LOCAL_NETWORK_STATIC_IP_ADDRESS" "$NEW_STATIC_IP"
|
||||||
|
@ -1508,44 +1510,19 @@ Enter a static local IP address for this system.\n\nIt will typically be ${IPv4_
|
||||||
esac
|
esac
|
||||||
fi
|
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
|
if [ ! $static_wifi_address ]; then
|
||||||
# wired network
|
# wired network
|
||||||
remove_wifi_startup_script
|
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 'auto eth0' > /etc/network/interfaces.d/static
|
||||||
echo '' >> /etc/network/interfaces
|
echo 'iface eth0 inet static' >> /etc/network/interfaces.d/static
|
||||||
echo '# The loopback network interface' >> /etc/network/interfaces
|
echo " address ${NEW_STATIC_IP}" >> /etc/network/interfaces.d/static
|
||||||
echo 'auto lo' >> /etc/network/interfaces
|
echo ' netmask 255.255.255.0' >> /etc/network/interfaces.d/static
|
||||||
echo 'iface lo inet loopback' >> /etc/network/interfaces
|
echo " gateway ${NEW_STATIC_GATEWAY}" >> /etc/network/interfaces.d/static
|
||||||
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
|
|
||||||
else
|
else
|
||||||
# wifi network
|
# wifi network
|
||||||
wifi_settings
|
wifi_settings
|
||||||
|
@ -2036,7 +2013,7 @@ function menu_wifi {
|
||||||
if [ -f /etc/hostapd/hostapd.conf ]; then
|
if [ -f /etc/hostapd/hostapd.conf ]; then
|
||||||
status_str=$'Hotspot ON'
|
status_str=$'Hotspot ON'
|
||||||
else
|
else
|
||||||
if grep -q "# wifi enabled" /etc/network/interfaces; then
|
if [ -f /etc/network/interfaces.d/wifi ]; then
|
||||||
status_str=$'Wifi ON'
|
status_str=$'Wifi ON'
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -183,14 +183,16 @@ configure_networking() {
|
||||||
if [[ "$MACHINE" == "beaglebonewifi" ]]; then
|
if [[ "$MACHINE" == "beaglebonewifi" ]]; then
|
||||||
# Allow networking over USB in order to configure the
|
# Allow networking over USB in order to configure the
|
||||||
# wifi login settings
|
# wifi login settings
|
||||||
echo 'auto lo' > $rootdir/etc/network/interfaces
|
|
||||||
echo 'iface lo inet loopback' >> $rootdir/etc/network/interfaces
|
echo '# This file describes the network interfaces available on your system' > $rootdir/etc/network/interfaces
|
||||||
echo '' >> $rootdir/etc/network/interfaces
|
echo '# and how to activate them. For more information, see interfaces(5).' >> $rootdir/etc/network/interfaces
|
||||||
echo 'iface usb0 inet static' >> $rootdir/etc/network/interfaces
|
echo 'source /etc/network/interfaces.d/*' >> $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 'iface usb0 inet static' >> $rootdir/etc/network/interfaces.d/usb
|
||||||
echo ' network 192.168.7.0' >> $rootdir/etc/network/interfaces
|
echo ' address 192.168.7.2' >> $rootdir/etc/network/interfaces.d/usb
|
||||||
echo ' gateway 192.168.7.1' >> $rootdir/etc/network/interfaces
|
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
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -199,41 +201,15 @@ configure_networking() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $GENERIC_IMAGE == "no" ]]; then
|
if [[ $GENERIC_IMAGE == "no" ]]; then
|
||||||
echo "# This file describes the network interfaces available on your system
|
echo '# This file describes the network interfaces available on your system' > $rootdir/etc/network/interfaces
|
||||||
# and how to activate them. For more information, see interfaces(5).
|
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
|
echo "auto eth0
|
||||||
auto lo
|
|
||||||
iface lo inet loopback
|
|
||||||
|
|
||||||
# The primary network interface
|
|
||||||
auto eth0
|
|
||||||
iface eth0 inet static
|
iface eth0 inet static
|
||||||
address $BOX_IP_ADDRESS
|
address $BOX_IP_ADDRESS
|
||||||
netmask 255.255.255.0
|
netmask 255.255.255.0
|
||||||
gateway $ROUTER_IP_ADDRESS
|
gateway $ROUTER_IP_ADDRESS" > $rootdir/etc/network/interfaces.d/static
|
||||||
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
|
|
||||||
|
|
||||||
hexarray=( 1 2 3 4 5 6 7 8 9 0 a b c d e f )
|
hexarray=( 1 2 3 4 5 6 7 8 9 0 a b c d e f )
|
||||||
a=${hexarray[$RANDOM%16]}${hexarray[$RANDOM%16]}
|
a=${hexarray[$RANDOM%16]}${hexarray[$RANDOM%16]}
|
||||||
|
@ -241,8 +217,7 @@ iface eth0 inet static
|
||||||
c=${hexarray[$RANDOM%16]}${hexarray[$RANDOM%16]}
|
c=${hexarray[$RANDOM%16]}${hexarray[$RANDOM%16]}
|
||||||
d=${hexarray[$RANDOM%16]}${hexarray[$RANDOM%16]}
|
d=${hexarray[$RANDOM%16]}${hexarray[$RANDOM%16]}
|
||||||
e=${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" \
|
echo "hwaddress ether de:$a:$b:$c:$d:$e" > $rootdir/etc/network/interfaces.d/macaddress
|
||||||
$rootdir/etc/network/interfaces
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# configure DNS
|
# configure DNS
|
||||||
|
|
|
@ -51,38 +51,15 @@ function install_static_network {
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo '# The loopback network interface' > /etc/network/interfaces
|
echo '# This file describes the network interfaces available on your system' > /etc/network/interfaces
|
||||||
echo 'auto lo' >> /etc/network/interfaces
|
echo '# and how to activate them. For more information, see interfaces(5).' >> /etc/network/interfaces
|
||||||
echo 'iface lo inet loopback' >> /etc/network/interfaces
|
echo 'source /etc/network/interfaces.d/*' >> /etc/network/interfaces
|
||||||
echo '' >> /etc/network/interfaces
|
|
||||||
echo '# The primary network interface' >> /etc/network/interfaces
|
echo 'auto eth0' > /etc/network/interfaces.d/static
|
||||||
echo 'auto eth0' >> /etc/network/interfaces
|
echo 'iface eth0 inet static' >> /etc/network/interfaces.d/static
|
||||||
echo 'iface eth0 inet static' >> /etc/network/interfaces
|
echo " address $LOCAL_NETWORK_STATIC_IP_ADDRESS" >> /etc/network/interfaces.d/static
|
||||||
echo " address $LOCAL_NETWORK_STATIC_IP_ADDRESS" >> /etc/network/interfaces
|
echo ' netmask 255.255.255.0' >> /etc/network/interfaces.d/static
|
||||||
echo ' netmask 255.255.255.0' >> /etc/network/interfaces
|
echo " gateway $ROUTER_IP_ADDRESS" >> /etc/network/interfaces.d/static
|
||||||
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
|
|
||||||
|
|
||||||
mark_completed $FUNCNAME
|
mark_completed $FUNCNAME
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,12 @@ WIFI_NETWORKS_FILE=~/${PROJECT_NAME}-wifi.cfg
|
||||||
# repo for atheros AR9271 wifi driver
|
# repo for atheros AR9271 wifi driver
|
||||||
ATHEROS_WIFI_REPO="https://github.com/qca/open-ath9k-htc-firmware.git"
|
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
|
# Debian stretch has a problem where the formerly predictable wlan0 and eth0
|
||||||
# device names get assigned random names. This is a hacky workaround.
|
# device names get assigned random names. This is a hacky workaround.
|
||||||
# Also adding net.ifnames=0 to kernel options on bootloader may work.
|
# 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
|
NETWORK_IS_STATIC=0
|
||||||
read_config_param "NETWORK_IS_STATIC"
|
read_config_param "NETWORK_IS_STATIC"
|
||||||
if [ ${NETWORK_IS_STATIC} -eq 0 ]; then
|
if [ ${NETWORK_IS_STATIC} -eq 0 ]; then
|
||||||
echo '#this line must always be here' >> /etc/network/interfaces
|
echo '#this line must always be here' > /etc/network/interfaces.d/static
|
||||||
echo 'iface default inet dhcp' >> /etc/network/interfaces
|
echo 'iface default inet dhcp' >> /etc/network/interfaces.d/static
|
||||||
else
|
else
|
||||||
read_config_param "LOCAL_NETWORK_STATIC_IP_ADDRESS"
|
read_config_param "LOCAL_NETWORK_STATIC_IP_ADDRESS"
|
||||||
read_config_param "ROUTER_IP_ADDRESS"
|
read_config_param "ROUTER_IP_ADDRESS"
|
||||||
echo '#static address' >> /etc/network/interfaces
|
echo 'iface default inet static' > /etc/network/interfaces.d/static
|
||||||
echo 'iface default inet static' >> /etc/network/interfaces
|
echo " address ${LOCAL_NETWORK_STATIC_IP_ADDRESS}" >> /etc/network/interfaces.d/static
|
||||||
echo " address ${LOCAL_NETWORK_STATIC_IP_ADDRESS}" >> /etc/network/interfaces
|
echo ' netmask 255.255.255.0' >> /etc/network/interfaces.d/static
|
||||||
echo ' netmask 255.255.255.0' >> /etc/network/interfaces
|
echo " gateway ${ROUTER_IP_ADDRESS}" >> /etc/network/interfaces.d/static
|
||||||
echo " gateway ${ROUTER_IP_ADDRESS}" >> /etc/network/interfaces
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,13 +245,25 @@ function hotspot_off {
|
||||||
|
|
||||||
rm /etc/hostapd/hostapd.conf
|
rm /etc/hostapd/hostapd.conf
|
||||||
|
|
||||||
if [ -f /etc/network/interfaces_original ]; then
|
if [ -f /etc/network/interfaces_original_static ]; then
|
||||||
cp /etc/network/interfaces_original /etc/network/interfaces
|
cp /etc/network/interfaces_original_static /etc/network/interfaces.d/static
|
||||||
else
|
else
|
||||||
echo '# interfaces(5) file used by ifup(8) and ifdown(8)' > /etc/network/interfaces
|
if [ -f /etc/network/interfaces.d/static ]; then
|
||||||
echo '# Include files from /etc/network/interfaces.d:' >> /etc/network/interfaces
|
rm /etc/network/interfaces.d/static
|
||||||
echo 'source-directory /etc/network/interfaces.d' >> /etc/network/interfaces
|
|
||||||
fi
|
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_action ${WIFI_INTERFACE} stop
|
||||||
wpa_cli -i ${WIFI_INTERFACE} terminate
|
wpa_cli -i ${WIFI_INTERFACE} terminate
|
||||||
|
@ -294,30 +311,29 @@ function hotspot_on {
|
||||||
echo '## Accept all MAC address ###' >> /etc/hostapd/hostapd.conf
|
echo '## Accept all MAC address ###' >> /etc/hostapd/hostapd.conf
|
||||||
echo 'macaddr_acl=0' >> /etc/hostapd/hostapd.conf
|
echo 'macaddr_acl=0' >> /etc/hostapd/hostapd.conf
|
||||||
|
|
||||||
if [ ! -f /etc/network/interfaces_original ]; then
|
if [ ! -f /etc/network/interfaces_original_static ]; then
|
||||||
if ! grep -q "# wifi enabled" /etc/network/interfaces; then
|
if [ -f /etc/network/interfaces.d/static ]; then
|
||||||
cp /etc/network/interfaces /etc/network/interfaces_original
|
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
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo '# wifi enabled' > /etc/network/interfaces
|
default_network_config
|
||||||
echo 'auto lo br0' >> /etc/network/interfaces
|
|
||||||
echo 'iface lo inet loopback' >> /etc/network/interfaces
|
echo "allow-hotplug $WIFI_INTERFACE" > /etc/network/interfaces.d/wifi
|
||||||
echo '' >> /etc/network/interfaces
|
echo "iface $WIFI_INTERFACE inet manual" >> /etc/network/interfaces.d/wifi
|
||||||
echo "# wireless $WIFI_INTERFACE" >> /etc/network/interfaces
|
|
||||||
echo "allow-hotplug $WIFI_INTERFACE" >> /etc/network/interfaces
|
echo 'allow-hotplug eth0' >> /etc/network/interfaces.d/static
|
||||||
echo "iface $WIFI_INTERFACE inet manual" >> /etc/network/interfaces
|
echo 'iface eth0 inet manual' >> /etc/network/interfaces.d/static
|
||||||
echo '' >> /etc/network/interfaces
|
|
||||||
echo '# eth0 connected to the ISP router' >> /etc/network/interfaces
|
echo 'iface br0 inet static' >> /etc/network/interfaces.d/bridge
|
||||||
echo 'allow-hotplug eth0' >> /etc/network/interfaces
|
echo " bridge_ports $WIFI_INTERFACE eth0" >> /etc/network/interfaces.d/bridge
|
||||||
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
|
|
||||||
|
|
||||||
systemctl restart network-manager
|
systemctl restart network-manager
|
||||||
#ifconfig $WIFI_INTERFACE up
|
|
||||||
ifup $WIFI_INTERFACE
|
ifup $WIFI_INTERFACE
|
||||||
systemctl restart hostapd
|
systemctl restart hostapd
|
||||||
}
|
}
|
||||||
|
@ -332,8 +348,14 @@ function wifi_store_original_network_settings {
|
||||||
|
|
||||||
function wifi_original_network_settings {
|
function wifi_original_network_settings {
|
||||||
remove_config_param "NETWORK_IS_STATIC"
|
remove_config_param "NETWORK_IS_STATIC"
|
||||||
if [ -f /etc/network/interfaces_original ]; then
|
if [ -f /etc/network/interfaces.d/static ]; then
|
||||||
cp /etc/network/interfaces_original /etc/network/interfaces
|
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
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -343,23 +365,17 @@ function wifi_wpa2_psk {
|
||||||
|
|
||||||
wifi_store_original_network_settings
|
wifi_store_original_network_settings
|
||||||
|
|
||||||
echo '# wifi enabled' > /etc/network/interfaces
|
echo 'allow-hotplug eth0' > /etc/network/interfaces.d/static
|
||||||
echo 'auto lo' >> /etc/network/interfaces
|
echo 'iface eth0 inet dhcp' >> /etc/network/interfaces.d/static
|
||||||
echo 'iface lo inet loopback' >> /etc/network/interfaces
|
|
||||||
echo '' >> /etc/network/interfaces
|
echo "allow-hotplug ${WIFI_INTERFACE}" > /etc/network/interfaces.d/wifi
|
||||||
echo 'allow-hotplug eth0' >> /etc/network/interfaces
|
echo "iface ${WIFI_INTERFACE} inet manual" >> /etc/network/interfaces.d/wifi
|
||||||
echo 'iface eth0 inet dhcp' >> /etc/network/interfaces
|
echo " wpa-roam $WIFI_CONFIG" >> /etc/network/interfaces.d/wifi
|
||||||
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
|
|
||||||
wifi_static_network_interface
|
wifi_static_network_interface
|
||||||
|
|
||||||
wpa_passphrase "$ssid" "$passphrase" > $WIFI_CONFIG
|
wpa_passphrase "$ssid" "$passphrase" > $WIFI_CONFIG
|
||||||
|
|
||||||
systemctl restart network-manager
|
systemctl restart network-manager
|
||||||
#ifconfig ${WIFI_INTERFACE} up
|
|
||||||
ifup $WIFI_INTERFACE
|
ifup $WIFI_INTERFACE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -368,17 +384,13 @@ function wifi_none {
|
||||||
|
|
||||||
wifi_store_original_network_settings
|
wifi_store_original_network_settings
|
||||||
|
|
||||||
echo '# wifi enabled' > /etc/network/interfaces
|
echo 'allow-hotplug eth0' > /etc/network/interfaces.d/static
|
||||||
echo 'auto lo' >> /etc/network/interfaces
|
echo 'iface eth0 inet dhcp' >> /etc/network/interfaces.d/static
|
||||||
echo 'iface lo inet loopback' >> /etc/network/interfaces
|
|
||||||
echo '' >> /etc/network/interfaces
|
echo "allow-hotplug ${WIFI_INTERFACE}" > /etc/network/interfaces.d/wifi
|
||||||
echo 'allow-hotplug eth0' >> /etc/network/interfaces
|
echo "iface ${WIFI_INTERFACE} inet manual" >> /etc/network/interfaces.d/wifi
|
||||||
echo 'iface eth0 inet dhcp' >> /etc/network/interfaces
|
echo " wpa-roam $WIFI_CONFIG" >> /etc/network/interfaces.d/wifi
|
||||||
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
|
|
||||||
wifi_static_network_interface
|
wifi_static_network_interface
|
||||||
|
|
||||||
echo 'ctrl_interface=/run/wpa_supplicant' > $WIFI_CONFIG
|
echo 'ctrl_interface=/run/wpa_supplicant' > $WIFI_CONFIG
|
||||||
|
@ -394,7 +406,6 @@ function wifi_none {
|
||||||
echo '}' >> $WIFI_CONFIG
|
echo '}' >> $WIFI_CONFIG
|
||||||
|
|
||||||
systemctl restart network-manager
|
systemctl restart network-manager
|
||||||
#ifconfig ${WIFI_INTERFACE} up
|
|
||||||
ifup $WIFI_INTERFACE
|
ifup $WIFI_INTERFACE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -410,17 +421,13 @@ function networks_from_file {
|
||||||
|
|
||||||
wifi_store_original_network_settings
|
wifi_store_original_network_settings
|
||||||
|
|
||||||
echo '# wifi enabled' > /etc/network/interfaces
|
echo 'allow-hotplug eth0' > /etc/network/interfaces.d/static
|
||||||
echo 'auto lo' >> /etc/network/interfaces
|
echo 'iface eth0 inet dhcp' >> /etc/network/interfaces.d/static
|
||||||
echo 'iface lo inet loopback' >> /etc/network/interfaces
|
|
||||||
echo '' >> /etc/network/interfaces
|
echo "allow-hotplug ${WIFI_INTERFACE}" >> /etc/network/interfaces.d/wifi
|
||||||
echo 'allow-hotplug eth0' >> /etc/network/interfaces
|
echo "iface ${WIFI_INTERFACE} inet manual" >> /etc/network/interfaces.d/wifi
|
||||||
echo 'iface eth0 inet dhcp' >> /etc/network/interfaces
|
echo " wpa-roam $WIFI_CONFIG" >> /etc/network/interfaces.d/wifi
|
||||||
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
|
|
||||||
wifi_static_network_interface
|
wifi_static_network_interface
|
||||||
|
|
||||||
# remove wpa_supplicant.conf if it exists
|
# remove wpa_supplicant.conf if it exists
|
||||||
|
@ -577,9 +584,19 @@ function create_networks_interactive {
|
||||||
function disable_wifi {
|
function disable_wifi {
|
||||||
if [[ ${1} == 'yes' || ${1} == 'y' ]]; then
|
if [[ ${1} == 'yes' || ${1} == 'y' ]]; then
|
||||||
hotspot_off
|
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
|
if [ -f /etc/network/interfaces.d/static ]; then
|
||||||
echo 'source-directory /etc/network/interfaces.d' >> /etc/network/interfaces
|
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"
|
remove_config_param "WIFI_INTERFACE"
|
||||||
wpa_action ${WIFI_INTERFACE} stop
|
wpa_action ${WIFI_INTERFACE} stop
|
||||||
wpa_cli -i ${WIFI_INTERFACE} terminate
|
wpa_cli -i ${WIFI_INTERFACE} terminate
|
||||||
|
|
Loading…
Reference in New Issue