1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-13 11:42:08 +00:00

on|off for wifi_up_down

This commit is contained in:
Jerry Vonau 2020-04-13 04:33:38 -05:00
parent 207cc98255
commit 13d7c38a73
2 changed files with 16 additions and 14 deletions

View file

@ -1,8 +1,10 @@
#!/bin/bash
{% if wifi_up_down %}
echo "Iiab-hotspot-up/down only functions when /etc/iiab/wifi_up_down is set to False"
echo " If you want hotspot on/off function please set wifi_up_down and run /opt/iiab/iiab/iiab-network"
systemctl disable hostapd
systemctl stop hostapd
sed -i -e "s/^HOSTAPD_ENABLED.*/HOSTAPD_ENABLED=False/" {{ iiab_env_file }}
echo " IIAB hotspot access point Disabled"
exit 0
{% else %}
@ -15,14 +17,13 @@ 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
# https://github.com/iiab/iiab/issues/638#issuecomment-355455454
if grep -qi raspbian /etc/*release; then
ip link set dev wlan0 promisc on
fi
#if grep -qi raspbian /etc/*release; then
# ip link set dev wlan0 promisc on
#fi
{% endif %}
sed -i -e "s/^HOSTAPD_ENABLED.*/HOSTAPD_ENABLED=False/" {{ iiab_env_file }}

View file

@ -1,8 +1,9 @@
#!/bin/bash
{% if wifi_up_down %}
echo "Iiab-hotspot-up/down only functions when /etc/iiab/wifi_up_down is set to False"
echo " If you want hotspot on/off function please set wifi_up_down and run /opt/iiab/iiab/iiab-network"
systemctl enable hostapd
sed -i -e "s/^HOSTAPD_ENABLED.*/HOSTAPD_ENABLED=True/" {{ iiab_env_file }}
echo -e "\nPlease reboot to activate hostapd feature.\n"
exit 0
{% else %}
@ -17,16 +18,16 @@ 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)
# SEE ALSO iiab-hotspot-off + /usr/libexec/iiab-startup.sh
# https://github.com/iiab/iiab/issues/638#issuecomment-355455454
if grep -qi raspbian /etc/*release; then
ip link set dev wlan0 promisc off
fi
#if grep -qi raspbian /etc/*release; then
# ip link set dev wlan0 promisc off
#fi
{% endif %}
sed -i -e "s/^HOSTAPD_ENABLED.*/HOSTAPD_ENABLED=True/" {{ iiab_env_file }}
echo -e "\nPlease consider rebooting now.\n"