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

Merge pull request #733 from holta/iiab-hotspot-on_and_iiab-hotspot-off

iiab-hotspot-on suggests reboot.  HOSTAPD_ENABLED live state in iiab.env (was iiab.ini)
This commit is contained in:
A Holt 2018-04-04 04:22:01 -04:00 committed by GitHub
commit 8ccf64ecec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 6 deletions

View file

@ -15,9 +15,9 @@ fi
if [[ $(grep -i raspbian /etc/*release) &&
#($(grep "hostapd_enabled = False" /etc/iiab/config_vars.yml) ||
#((! $(grep "hostapd_enabled = True" /etc/iiab/config_vars.yml)) &&
! $(grep "^hostapd_enabled = True" /etc/iiab/iiab.ini) ]];
! $(grep "^HOSTAPD_ENABLED=True" /etc/iiab/iiab.env) ]];
# NEGATED LOGIC HELPS FORCE PROMISCUOUS MODE EARLY IN INSTALL
# (when computed_network.yml has not yet populated iiab.ini)
# (when network/tasks/main.yml hasn't yet populated iiab.env)
# RESULT: WiFi-installed IIAB should have wlan0 properly in
# promiscuous mode Even On Reboots (if 2-common completed!)

View file

@ -11,14 +11,24 @@
no_net_restart: True # used below in (1) sysd-netd-debian.yml,
# (2) debian.yml, (3) rpi_debian.yml
when: discovered_wireless_iface == iiab_wan_iface and not reboot_to_AP
# EITHER WAY: hostapd_enabled's state is RECORDED into /etc/iiab/iiab.ini
# (by computed_ntetwork.yml below) for later use by...
# EITHER WAY: hostapd_enabled's state is RECORDED into /etc/iiab/iiab.env
# (happens just below) for later use by...
# /usr/libexec/iiab-startup.sh, iiab-hotspot-off & iiab-hotspot-on
#
# Separate Idea, Not Without Risks: should WiFi-as-gateway detection logic
# be encapsulated into roles/network/tasks/hostapd.yml in future? Whereas
# today "./runtags hostapd" doesn't exist & "./runtags AP" is UNSUPPORTED!
- name: Record HOSTAPD_ENABLED to /etc/iiab/iiab.env
lineinfile:
dest: /etc/iiab/iiab.env
regexp: '^HOSTAPD_ENABLED=*'
line: 'HOSTAPD_ENABLED={{ hostapd_enabled }}'
state: present
#when: not installing #REMOVE THIS LINE IF installing IS ALWAYS false AS SET IN roles/0-init/defaults/main.yml
tags:
- network
#- name: RPi - reboot to AP post install - installed via wifi so the services are ready
# set_fact:
# iiab_lan_iface: br0

View file

@ -16,4 +16,4 @@ if grep -qi raspbian /etc/*release; then
ip link set dev wlan0 promisc on
fi
sed -i -e "s/^hostapd_enabled.*/hostapd_enabled = False/" /etc/iiab/iiab.ini
sed -i -e "s/^HOSTAPD_ENABLED.*/HOSTAPD_ENABLED=False/" /etc/iiab/iiab.env

View file

@ -17,4 +17,6 @@ if grep -qi raspbian /etc/*release; then
ip link set dev wlan0 promisc off
fi
sed -i -e "s/^hostapd_enabled.*/hostapd_enabled = True/" /etc/iiab/iiab.ini
sed -i -e "s/^HOSTAPD_ENABLED.*/HOSTAPD_ENABLED=True/" /etc/iiab/iiab.env
echo -e "\nPlease consider rebooting now.\n"