1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-03-09 15:40:17 +00:00

wpa workaround doc'd and moved

This commit is contained in:
Jerry Vonau 2020-05-05 11:27:57 -05:00
parent 23940fcdc4
commit 933ca564bd

View file

@ -22,6 +22,7 @@ fi
if [ -f /run/netplan/wpa-$IFACE.conf ]; then if [ -f /run/netplan/wpa-$IFACE.conf ]; then
NETPLAN=1 NETPLAN=1
SSID=`grep ssid /run/netplan/wpa-$IFACE.conf | awk -F = '{print $2}' | sed -r s/\"// | sed -r s/\"//` SSID=`grep ssid /run/netplan/wpa-$IFACE.conf | awk -F = '{print $2}' | sed -r s/\"// | sed -r s/\"//`
# covers netplan lack of country=
sed 's|ctrl_interface=/run/wpa_supplicant|&\ncountry={{ host_country_code }}|' /run/netplan/wpa-$IFACE.conf sed 's|ctrl_interface=/run/wpa_supplicant|&\ncountry={{ host_country_code }}|' /run/netplan/wpa-$IFACE.conf
fi fi
# IIAB hint for NetworkManager # IIAB hint for NetworkManager
@ -41,9 +42,8 @@ fi
#if [ $RASPBIAN -eq 1 ]; then #if [ $RASPBIAN -eq 1 ]; then
# systemctl start wpa_supplicant # systemctl start wpa_supplicant
#fi #fi
sleep 2
wpa_cli -i $IFACE scan > /dev/null wpa_cli -i $IFACE scan > /dev/null
sleep 1 sleep 2
FREQ=`wpa_cli -i $IFACE scan_results | grep $SSID | awk '{print $2}'` FREQ=`wpa_cli -i $IFACE scan_results | grep $SSID | awk '{print $2}'`
for result in $FREQ; do for result in $FREQ; do
echo "frequency is $result for $SSID" echo "frequency is $result for $SSID"
@ -62,12 +62,16 @@ if [ $CHAN -ne $HOSTAPD ]; then
echo "Editing Hostapd for channel $CHAN" echo "Editing Hostapd for channel $CHAN"
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 # too soon to for raspbian to call hostapd but hostapd gets called after this script anyway.
systemctl start hostapd if [ RASPBIAN -eq 0 ]; then
systemctl start wpa_supplicant systemctl stop wpa_supplicant
# This is more of a netplan workaround should go away. systemctl start hostapd
if [ $NETPLAN -eq 1 ]; then systemctl start wpa_supplicant
systemctl restart netplan-wpa-$IFACE.service
fi fi
fi fi
# covers netplan lack of country=
if [ $NETPLAN -eq 1 ]; then
# This is more of a netplan workaround should go away.
systemctl restart netplan-wpa-$IFACE.service
fi
exit 0 exit 0