mirror of
				https://github.com/iiab/iiab.git
				synced 2025-03-09 15:40:17 +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:
		
						commit
						8ccf64ecec
					
				
					 4 changed files with 18 additions and 6 deletions
				
			
		|  | @ -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!) | ||||
|  |  | |||
|  | @ -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 | ||||
|  |  | |||
|  | @ -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 | ||||
|  |  | |||
|  | @ -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" | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue