2017-11-19 00:48:13 +00:00
|
|
|
#!/bin/bash
|
2022-05-19 19:05:21 +00:00
|
|
|
{% if not can_be_ap %}
|
2022-05-19 20:11:58 +00:00
|
|
|
echo -e "\nUH-OH: Your Wi-Fi firmware doesn't support AP mode, according to 'iw list'\n"
|
|
|
|
echo -e "If you add Wi-Fi hardware, run 'cd /opt/iiab/iiab' then 'sudo ./iiab-network'\n"
|
|
|
|
echo -e "For details, see: https://github.com/iiab/iiab/pull/3179\n"
|
|
|
|
exit 1
|
2022-05-19 19:05:21 +00:00
|
|
|
{% else %}
|
2020-05-06 15:14:25 +00:00
|
|
|
sed -i -e "s/^HOSTAPD_ENABLED.*/HOSTAPD_ENABLED=True/" {{ iiab_env_file }}
|
|
|
|
{% if wifi_up_down %}
|
2021-07-28 02:36:07 +00:00
|
|
|
systemctl enable iiab-clone-wifi.service
|
2020-05-06 15:14:25 +00:00
|
|
|
systemctl enable hostapd
|
2021-07-28 02:36:07 +00:00
|
|
|
systemctl enable iiab-wifi-test.service
|
2020-05-06 15:14:25 +00:00
|
|
|
echo -e "\nPlease reboot to activate hostapd feature.\n"
|
|
|
|
exit 0
|
|
|
|
{% else %}
|
2020-04-30 05:58:24 +00:00
|
|
|
{% if is_raspbian %}
|
2020-04-12 16:43:20 +00:00
|
|
|
# just do what we have always done in hotspot-on
|
|
|
|
cp -f /etc/hostapd/hostapd.conf.iiab /etc/hostapd/hostapd.conf
|
|
|
|
sed -i -e "s/^#denyinterfaces/denyinterfaces/" /etc/dhcpcd.conf
|
2019-05-28 18:04:04 +00:00
|
|
|
# shut down wlan0 in case connected to network
|
2020-04-12 16:43:20 +00:00
|
|
|
ip link set wlan0 down
|
2017-11-19 00:48:13 +00:00
|
|
|
systemctl enable hostapd
|
2020-02-26 08:23:27 +00:00
|
|
|
#systemctl daemon-reload
|
2020-04-12 16:43:20 +00:00
|
|
|
systemctl daemon-reload
|
|
|
|
systemctl restart dhcpcd
|
2017-11-19 02:30:41 +00:00
|
|
|
systemctl start hostapd
|
2019-01-02 06:04:41 +00:00
|
|
|
systemctl start dnsmasq
|
2020-04-13 09:33:38 +00:00
|
|
|
|
2018-01-11 04:41:18 +00:00
|
|
|
# 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
|
2020-04-13 09:33:38 +00:00
|
|
|
#if grep -qi raspbian /etc/*release; then
|
|
|
|
# ip link set dev wlan0 promisc off
|
|
|
|
#fi
|
2020-04-30 05:58:24 +00:00
|
|
|
{% else %}
|
2020-05-06 15:14:25 +00:00
|
|
|
#ubuntu
|
2020-10-24 14:01:41 +00:00
|
|
|
if [ -f /etc/NetworkManager/conf.d/wifi-manage.conf ]; then
|
2020-05-06 15:14:25 +00:00
|
|
|
sed -i -e "s|managed=1|managed=0|" /etc/NetworkManager/conf.d/wifi-manage.conf
|
|
|
|
fi
|
2020-04-27 16:10:37 +00:00
|
|
|
systemctl enable hostapd
|
2020-04-30 05:58:24 +00:00
|
|
|
echo -e "\nPlease reboot to activate hostapd feature.\n"
|
|
|
|
exit 0
|
|
|
|
{% endif %}
|
2020-05-06 15:14:25 +00:00
|
|
|
#wifi_up_down
|
2020-04-30 05:58:24 +00:00
|
|
|
{% endif %}
|
2022-05-19 19:05:21 +00:00
|
|
|
{% endif %}
|