mirror of
https://github.com/iiab/iiab.git
synced 2025-02-15 04:32:11 +00:00
netplan2
This commit is contained in:
parent
cb86366b13
commit
04ce0a9d7f
1 changed files with 21 additions and 8 deletions
|
@ -5,6 +5,7 @@ SSID=""
|
||||||
# when we get here br0 should be available and dbus wpa_supplicant was started if enabled. Some
|
# when we get here br0 should be available and dbus wpa_supplicant was started if enabled. Some
|
||||||
# of the backends that use wpa_supplicant should be active based on the Before= After= lines in
|
# of the backends that use wpa_supplicant should be active based on the Before= After= lines in
|
||||||
# the iiab-wifi-test.service unit file.
|
# the iiab-wifi-test.service unit file.
|
||||||
|
# https://github.com/iiab/iiab/pull/3542#issuecomment-1519647266
|
||||||
|
|
||||||
echo "iiab-test-wifi called"
|
echo "iiab-test-wifi called"
|
||||||
echo "running pid $$"
|
echo "running pid $$"
|
||||||
|
@ -31,6 +32,7 @@ if [ -f /run/netplan/wpa-$IFACE.conf ]; then
|
||||||
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/\"//)
|
||||||
REG_DOM=$(grep country /run/netplan/wpa-$IFACE.conf | awk -F = '{ print $2 }')
|
REG_DOM=$(grep country /run/netplan/wpa-$IFACE.conf | awk -F = '{ print $2 }')
|
||||||
if [ -z "$REG_DOM" ]; then
|
if [ -z "$REG_DOM" ]; then
|
||||||
|
NETPLAN=2
|
||||||
echo "cover netplan wifi client lack of country= setting to {{ host_country_code }}"
|
echo "cover netplan wifi client lack of country= setting to {{ host_country_code }}"
|
||||||
sed -i "s|ctrl_interface=/run/wpa_supplicant|&\ncountry={{ host_country_code }}|" /run/netplan/wpa-$IFACE.conf
|
sed -i "s|ctrl_interface=/run/wpa_supplicant|&\ncountry={{ host_country_code }}|" /run/netplan/wpa-$IFACE.conf
|
||||||
else
|
else
|
||||||
|
@ -52,11 +54,28 @@ echo "ssid is $SSID"
|
||||||
|
|
||||||
if [ -z "$SSID" ]; then
|
if [ -z "$SSID" ]; then
|
||||||
echo "Couldn't find ssid $SSID to use exiting"
|
echo "Couldn't find ssid $SSID to use exiting"
|
||||||
if [ $NETPLAN -eq 1 ]; then
|
if [ $NETPLAN -gt 0 ]; then
|
||||||
echo "Netplan1"
|
echo "Netplan1"
|
||||||
fi
|
fi
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ $NETPLAN -gt 0 ]; then
|
||||||
|
echo "Netplan2"
|
||||||
|
wpa_processes=$(ps -A | grep wpa_supplicant | wc -l)
|
||||||
|
if [ $wpa_processes -eq 1 ]; then
|
||||||
|
# This is more of a netplan workaround should go away.
|
||||||
|
echo "Starting netplan wifi"
|
||||||
|
NETPLAN=2
|
||||||
|
else
|
||||||
|
echo "Restarting netplan wifi"
|
||||||
|
fi
|
||||||
|
# This one handles the changing of the country code from above
|
||||||
|
if [ $NETPLAN -eq 2 ]; then
|
||||||
|
/bin/systemctl restart netplan-wpa-$IFACE.service
|
||||||
|
sleep 2
|
||||||
|
fi
|
||||||
|
fi
|
||||||
wpa_cli -i $IFACE scan > /dev/null
|
wpa_cli -i $IFACE scan > /dev/null
|
||||||
sleep 2
|
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}')
|
||||||
|
@ -72,15 +91,9 @@ done
|
||||||
|
|
||||||
echo "Using $FREQ2 for $SSID"
|
echo "Using $FREQ2 for $SSID"
|
||||||
|
|
||||||
if [ $NETPLAN -eq 1 ]; then
|
|
||||||
echo "Netplan2"
|
|
||||||
# This is more of a netplan workaround should go away.
|
|
||||||
/bin/systemctl restart netplan-wpa-$IFACE.service
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$FREQ2" ]; then
|
if [ -z "$FREQ2" ]; then
|
||||||
echo "Couldn't find frequency to use exiting"
|
echo "Couldn't find frequency to use exiting"
|
||||||
if [ $NETPLAN -eq 1 ]; then
|
if [ $NETPLAN -gt 0 ]; then
|
||||||
echo "Netplan3"
|
echo "Netplan3"
|
||||||
fi
|
fi
|
||||||
exit 0
|
exit 0
|
||||||
|
|
Loading…
Reference in a new issue