From 0024a0c17f7d44bfda0606765931b36bd25dc3c0 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Wed, 6 May 2020 10:14:25 -0500 Subject: [PATCH] hotspots revised --- .../templates/network/iiab-hotspot-off | 28 ++++++++++--------- .../network/templates/network/iiab-hotspot-on | 23 ++++++++------- 2 files changed, 28 insertions(+), 23 deletions(-) diff --git a/roles/network/templates/network/iiab-hotspot-off b/roles/network/templates/network/iiab-hotspot-off index 217bee07e..1f6e1283e 100755 --- a/roles/network/templates/network/iiab-hotspot-off +++ b/roles/network/templates/network/iiab-hotspot-off @@ -1,4 +1,14 @@ #!/bin/bash +sed -i -e "s/^HOSTAPD_ENABLED.*/HOSTAPD_ENABLED=False/" {{ iiab_env_file }} +systemctl disable hostapd +systemctl stop hostapd +{% 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 %} {% if is_raspbian %} # hotspot-off before ap0_updown sed -i -e "s/^denyinterfaces/#denyinterfaces/" /etc/dhcpcd.conf @@ -9,7 +19,6 @@ systemctl stop hostapd systemctl daemon-reload systemctl restart dhcpcd #systemctl restart networking 6/15/2019 TFM removed -sed -i -e "s/^HOSTAPD_ENABLED.*/HOSTAPD_ENABLED=False/" {{ iiab_env_file }} # Temporary promiscuous-mode workaround for RPi's WiFi "10SEC disease" # Set wlan0 to promiscuous when AP's OFF (for possible WiFi gateway) # SEE ALSO iiab-hotspot-on + /usr/libexec/iiab-startup.sh @@ -17,20 +26,13 @@ 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 }} -{% 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 +#ubuntu +if [ -f /etc/NetworkManager/conf.d/wifi-manage.conf ] + sed -i -e "s|managed=0|managed=1|" /etc/NetworkManager/conf.d/wifi-manage.conf +fi echo -e "\nPlease reboot to enable upstream WiFi access.\n" exit 0 {% endif %} +#wifi_up_down {% endif %} diff --git a/roles/network/templates/network/iiab-hotspot-on b/roles/network/templates/network/iiab-hotspot-on index fd65c2ab5..2c0854b82 100755 --- a/roles/network/templates/network/iiab-hotspot-on +++ b/roles/network/templates/network/iiab-hotspot-on @@ -1,4 +1,12 @@ #!/bin/bash +sed -i -e "s/^HOSTAPD_ENABLED.*/HOSTAPD_ENABLED=True/" {{ iiab_env_file }} +{% if wifi_up_down %} +systemctl enable clone-wifi.service +systemctl enable hostapd +systemctl enable wifi-test.service +echo -e "\nPlease reboot to activate hostapd feature.\n" +exit 0 +{% else %} {% if is_raspbian %} # just do what we have always done in hotspot-on cp -f /etc/hostapd/hostapd.conf.iiab /etc/hostapd/hostapd.conf @@ -11,7 +19,6 @@ systemctl daemon-reload systemctl restart dhcpcd systemctl start hostapd systemctl start dnsmasq -sed -i -e "s/^HOSTAPD_ENABLED.*/HOSTAPD_ENABLED=True/" {{ iiab_env_file }} # Temporary promiscuous-mode workaround for RPi's WiFi "10SEC disease" # Disable "promiscuous" on wlan0 when AP (i.e. no WiFi gateway) @@ -20,18 +27,14 @@ sed -i -e "s/^HOSTAPD_ENABLED.*/HOSTAPD_ENABLED=True/" {{ iiab_env_file }} #if grep -qi raspbian /etc/*release; then # ip link set dev wlan0 promisc off #fi - {% else %} -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 +#ubuntu +if [ -f /etc/NetworkManager/conf.d/wifi-manage.conf ] + sed -i -e "s|managed=1|managed=0|" /etc/NetworkManager/conf.d/wifi-manage.conf +fi systemctl enable hostapd echo -e "\nPlease reboot to activate hostapd feature.\n" exit 0 {% endif %} +#wifi_up_down {% endif %}