Skip to content
Snippets Groups Projects
Unverified Commit 266c31e1 authored by Bob Mottram's avatar Bob Mottram
Browse files

Improve wifi configuration

parent c363cb9c
No related branches found
No related tags found
No related merge requests found
......@@ -111,12 +111,12 @@ function hotspot_on {
echo 'macaddr_acl=0' >> /etc/hostapd/hostapd.conf
if [ ! -f /etc/network/interfaces_original ]; then
if ! grep -q "# Hotspot" /etc/network/interfaces; then
if ! grep -q "# wifi enabled" /etc/network/interfaces; then
cp /etc/network/interfaces /etc/network/interfaces_original
fi
fi
echo '# Hotspot' > /etc/network/interfaces
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
......@@ -139,11 +139,29 @@ function hotspot_on {
function wifi_wpa2_psk {
ssid=$1
passphrase=$2
psk=$(wifi_get_psk "$ssid" "$passphrase")
echo "auto $WIFI_INTERFACE" > /etc/network/interfaces.d/wifi
echo "iface $WIFI_INTERFACE inet dhcp" >> /etc/network/interfaces.d/wifi
echo " wpa-ssid $ssid" >> /etc/network/interfaces.d/wifi
echo " wpa-psk $psk" >> /etc/network/interfaces.d/wifi
if [ ! -f /etc/network/interfaces_original ]; then
if ! grep -q "# wifi enabled" /etc/network/interfaces; then
cp /etc/network/interfaces /etc/network/interfaces_original
fi
fi
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 wlan0' >> /etc/network/interfaces
echo 'iface wlan0 inet manual' >> /etc/network/interfaces
echo 'wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf' >> /etc/network/interfaces
echo '' >> /etc/network/interfaces
echo 'iface default inet dhcp' >> /etc/network/interfaces
wpa_passphrase "$ssid" "$passphrase" > /etc/wpa_supplicant/wpa_supplicant.conf
systemctl restart network-manager
}
function wifi_none {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment