From 664b540fdb2a8bddb5707e7408b4a5c5fc9c41ea Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Mon, 27 Apr 2020 11:10:37 -0500 Subject: [PATCH] update iiab-hotspot-on|off --- roles/network/templates/hostapd/clone-wifi.service.j2 | 1 + roles/network/templates/network/iiab-hotspot-off | 6 +++++- roles/network/templates/network/iiab-hotspot-on | 5 +++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/roles/network/templates/hostapd/clone-wifi.service.j2 b/roles/network/templates/hostapd/clone-wifi.service.j2 index c7171d66f..9fc83ddb8 100644 --- a/roles/network/templates/hostapd/clone-wifi.service.j2 +++ b/roles/network/templates/hostapd/clone-wifi.service.j2 @@ -15,6 +15,7 @@ RemainAfterExit=yes ExecStartPre=-/sbin/iw phy phy0 interface add ap0 type __ap ExecStartPre=-/sbin/ip link set ap0 address {{ ap0_mac_addr }} ExecStart=-/sbin/ip link set ap0 up +ExecStop=-/sbin/iw dev ap0 del [Install] WantedBy=multi-user.target diff --git a/roles/network/templates/network/iiab-hotspot-off b/roles/network/templates/network/iiab-hotspot-off index 7cc396dac..217bee07e 100755 --- a/roles/network/templates/network/iiab-hotspot-off +++ b/roles/network/templates/network/iiab-hotspot-off @@ -17,12 +17,16 @@ sed -i -e "s/^HOSTAPD_ENABLED.*/HOSTAPD_ENABLED=False/" {{ iiab_env_file }} #if grep -qi raspbian /etc/*release; then # ip link set dev wlan0 promisc on #fi + {% else %} systemctl disable hostapd systemctl stop hostapd sed -i -e "s/^HOSTAPD_ENABLED.*/HOSTAPD_ENABLED=False/" {{ iiab_env_file }} -echo " IIAB hotspot access point Disabled" {% if wifi_up_down %} +systemctl disable clone-wifi.service +systemctl disable wifi-test.service +systemctl stop clone-wifi.service +echo " IIAB hotspot access point Disabled" exit 0 {% else %} sed -i -e "s|managed=0|managed=1|" /etc/NetworkManager/conf.d/wifi-manage.conf diff --git a/roles/network/templates/network/iiab-hotspot-on b/roles/network/templates/network/iiab-hotspot-on index 03c038197..fd65c2ab5 100755 --- a/roles/network/templates/network/iiab-hotspot-on +++ b/roles/network/templates/network/iiab-hotspot-on @@ -1,5 +1,4 @@ #!/bin/bash - {% if is_raspbian %} # just do what we have always done in hotspot-on cp -f /etc/hostapd/hostapd.conf.iiab /etc/hostapd/hostapd.conf @@ -23,13 +22,15 @@ sed -i -e "s/^HOSTAPD_ENABLED.*/HOSTAPD_ENABLED=True/" {{ iiab_env_file }} #fi {% else %} -systemctl enable hostapd sed -i -e "s/^HOSTAPD_ENABLED.*/HOSTAPD_ENABLED=True/" {{ iiab_env_file }} {% if wifi_up_down %} +systemctl enable clone-wifi.service +systemctl enable wifi-test.service echo -e "\nPlease reboot to activate hostapd feature.\n" exit 0 {% else %} sed -i -e "s|managed=1|managed=0|" /etc/NetworkManager/conf.d/wifi-manage.conf +systemctl enable hostapd echo -e "\nPlease reboot to activate hostapd feature.\n" exit 0 {% endif %}