mirror of
https://github.com/iiab/iiab.git
synced 2025-03-09 15:40:17 +00:00
deal with netplan
This commit is contained in:
parent
83793e72e4
commit
6fb76de522
1 changed files with 15 additions and 5 deletions
|
@ -1,13 +1,23 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
IFACE={{ discovered_wireless_iface }}
|
IFACE={{ discovered_wireless_iface }}
|
||||||
|
NETPLAN=0
|
||||||
SSID=""
|
SSID=""
|
||||||
if [ -f /run/netplan/wpa-$IFACE.conf ]; then
|
# covers systemd-networkd
|
||||||
SSID=`grep ssid /run/netplan/wpa-$IFACE.conf | awk -F = '{print $2}' | sed -r s/\"// | sed -r s/\"//`
|
if [ -f /etc/wpa_supplicant/wpa_supplicant-$IFACE.conf ]; then
|
||||||
|
SSID=`grep ssid /etc/wpa_supplicant/wpa_supplicant-$IFACE.conf | awk -F = '{print $2}' | sed -r s/\"// | sed -r s/\"//`
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# covers raspbian
|
||||||
if [ -f /etc/wpa_supplicant/wpa_supplicant.conf ]; then
|
if [ -f /etc/wpa_supplicant/wpa_supplicant.conf ]; then
|
||||||
SSID=`grep ssid /etc/wpa_supplicant/wpa_supplicant.conf | awk -F = '{print $2}' | sed -r s/\"// | sed -r s/\"//`
|
SSID=`grep ssid /etc/wpa_supplicant/wpa_supplicant.conf | awk -F = '{print $2}' | sed -r s/\"// | sed -r s/\"//`
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# covers netplan
|
||||||
|
if [ -f /run/netplan/wpa-$IFACE.conf ]; then
|
||||||
|
NETPLAN=1
|
||||||
|
SSID=`grep ssid /run/netplan/wpa-$IFACE.conf | awk -F = '{print $2}' | sed -r s/\"// | sed -r s/\"//`
|
||||||
|
fi
|
||||||
|
# IIAB hint for NetworkManager
|
||||||
if [ -f /etc/iiab/iiab.env ]; then
|
if [ -f /etc/iiab/iiab.env ]; then
|
||||||
source /etc/iiab/iiab.env
|
source /etc/iiab/iiab.env
|
||||||
if [ ! -z $CLIENT_SSID ]; then
|
if [ ! -z $CLIENT_SSID ]; then
|
||||||
|
@ -32,11 +42,11 @@ echo "channel is $CHAN for $SSID"
|
||||||
cp /etc/hostapd/hostapd.conf.iiab /etc/hostapd/hostapd.conf
|
cp /etc/hostapd/hostapd.conf.iiab /etc/hostapd/hostapd.conf
|
||||||
sed -i -e "s/^channel.*/channel=$CHAN/" /etc/hostapd/hostapd.conf
|
sed -i -e "s/^channel.*/channel=$CHAN/" /etc/hostapd/hostapd.conf
|
||||||
systemctl stop wpa_supplicant
|
systemctl stop wpa_supplicant
|
||||||
#systemctl daemon-reload
|
|
||||||
systemctl start hostapd
|
systemctl start hostapd
|
||||||
#systemctl stop wpa_supplicant
|
|
||||||
systemctl start wpa_supplicant
|
systemctl start wpa_supplicant
|
||||||
systemctl restart netplan-wpa-wlan0.service
|
if [ $NETPLAN -eq 1 ]; then
|
||||||
|
systemctl restart netplan-wpa-wlan0.service
|
||||||
|
fi
|
||||||
systemctl stop dnsmasq.service
|
systemctl stop dnsmasq.service
|
||||||
systemctl start dnsmasq.service
|
systemctl start dnsmasq.service
|
||||||
exit 0
|
exit 0
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue