From 13e25494c0047089501ff7fc6d1a766db572a684 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sat, 1 Aug 2020 00:05:31 -0500 Subject: [PATCH 01/29] RPiOS - use dhcpcd hooks to restart hostapd when br0 appears --- roles/network/templates/hostapd/50-hostapd | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/roles/network/templates/hostapd/50-hostapd b/roles/network/templates/hostapd/50-hostapd index 601f8660a..d3741e1ab 100644 --- a/roles/network/templates/hostapd/50-hostapd +++ b/roles/network/templates/hostapd/50-hostapd @@ -1,3 +1,7 @@ +if [ "$interface" = "br0" ] && [ $if_up = "true" ]; then + sleep 2 + systemctl restart dnsmasq +fi if [ "$interface" = "wlan0" ]; then REASON="$reason" From e57cad010ebc6deaf9b58119da5861661ecb67f9 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sat, 1 Aug 2020 11:06:45 -0500 Subject: [PATCH 02/29] Ubuntu - use networkd-dispatcher hooks to restart hostapd when br0 appears --- roles/network/tasks/enable_services.yml | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/roles/network/tasks/enable_services.yml b/roles/network/tasks/enable_services.yml index c52809960..1ce2e06bf 100644 --- a/roles/network/tasks/enable_services.yml +++ b/roles/network/tasks/enable_services.yml @@ -85,23 +85,22 @@ #- debug: # var: nd_enabled -#- name: Check if /etc/networkd-dispatcher/routable.d exists -# stat: -# path: /etc/networkd-dispatcher/routable.d -# register: nd_dir +- name: Check if /etc/networkd-dispatcher/routable.d exists + stat: + path: /etc/networkd-dispatcher/routable.d + register: nd_dir #- debug: # var: nd_dir -#- name: To restart dnsmasq whenever br0 comes up, install /etc/networkd-dispatcher/routable.d/dnsmasq.sh from template (if isn't Appliance, and networkd-dispatcher is enabled, and directory /etc/networkd-dispatcher/routable.d exists, i.e. OS's like Ubuntu 18.04) -#- name: To restart dnsmasq whenever br0 comes up, install /etc/networkd-dispatcher/routable.d/dnsmasq.sh from template (if isn't Appliance, and directory /etc/networkd-dispatcher/routable.d exists, i.e. OS's like Ubuntu 18.04) -# template: -# src: roles/network/templates/network/dnsmasq.sh.j2 -# dest: /etc/networkd-dispatcher/routable.d/dnsmasq.sh -# mode: 0755 -# owner: root -# group: root -# when: dnsmasq_install and dnsmasq_enabled and nd_dir.stat.exists and nd_dir.stat.isdir and (iiab_network_mode != "Appliance") +- name: To restart dnsmasq whenever br0 comes up, install /etc/networkd-dispatcher/routable.d/dnsmasq.sh from template (if isn't Appliance, and directory /etc/networkd-dispatcher/routable.d exists, i.e. OS's like Ubuntu 18.04 or later) + template: + src: roles/network/templates/network/dnsmasq.sh.j2 + dest: /etc/networkd-dispatcher/routable.d/dnsmasq.sh + mode: 0755 + owner: root + group: root + when: dnsmasq_install and dnsmasq_enabled and nd_dir.stat.exists and nd_dir.stat.isdir and (iiab_network_mode != "Appliance") #when: dnsmasq_install and dnsmasq_enabled and nd_enabled is defined and nd_enabled.stdout == "enabled" and nd_dir.stat.exists and nd_dir.stat.isdir and (iiab_network_mode != "Appliance") #when: dnsmasq_install and dnsmasq_enabled and systemd_out.status.UnitFileState == "enabled" and networkd_dir.stat.exists and networkd_dir.stat.isdir and (iiab_network_mode != "Appliance") From 6e29ed1c3a98630adbc55b29a14d21941147d8b9 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sat, 1 Aug 2020 11:08:02 -0500 Subject: [PATCH 03/29] RPiOS - use 'no-block' with dhcpcd --- roles/network/templates/hostapd/50-hostapd | 3 ++- roles/network/templates/network/dnsmasq.sh.j2 | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/roles/network/templates/hostapd/50-hostapd b/roles/network/templates/hostapd/50-hostapd index d3741e1ab..603f570a8 100644 --- a/roles/network/templates/hostapd/50-hostapd +++ b/roles/network/templates/hostapd/50-hostapd @@ -1,6 +1,7 @@ if [ "$interface" = "br0" ] && [ $if_up = "true" ]; then + syslog info "50-iiab IF_UP br0 restarting dnsmasq" sleep 2 - systemctl restart dnsmasq + systemctl --no-block restart dnsmasq fi if [ "$interface" = "wlan0" ]; then diff --git a/roles/network/templates/network/dnsmasq.sh.j2 b/roles/network/templates/network/dnsmasq.sh.j2 index 1969f8da5..00df42bf3 100755 --- a/roles/network/templates/network/dnsmasq.sh.j2 +++ b/roles/network/templates/network/dnsmasq.sh.j2 @@ -3,5 +3,5 @@ if [ "$IFACE" == "{{ iiab_lan_iface }}" ]; then echo "Restarting dnsmasq in 5 seconds" /bin/sleep 5 && /bin/systemctl --no-block restart dnsmasq.service - echo "Restarting dnsmasq" + echo "Restarted dnsmasq" fi From f6c31f80ba9e7ea404b049c96b784d2f9d7592ff Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sun, 2 Aug 2020 13:36:56 -0500 Subject: [PATCH 04/29] handle firmware downgrade --- roles/firmware/tasks/install.yml | 23 +++++++++++++++++++ roles/firmware/tasks/main.yml | 20 ++++++++++++++++ .../firmware/templates/check-firmware.service | 11 +++++++++ roles/firmware/templates/check-firmware.sh | 22 ++++++++++++++++++ roles/firmware/templates/fw_warn.sh | 6 +++++ roles/network/tasks/main.yml | 5 ++++ 6 files changed, 87 insertions(+) create mode 100644 roles/firmware/tasks/install.yml create mode 100644 roles/firmware/tasks/main.yml create mode 100644 roles/firmware/templates/check-firmware.service create mode 100644 roles/firmware/templates/check-firmware.sh create mode 100644 roles/firmware/templates/fw_warn.sh diff --git a/roles/firmware/tasks/install.yml b/roles/firmware/tasks/install.yml new file mode 100644 index 000000000..0bfe74f63 --- /dev/null +++ b/roles/firmware/tasks/install.yml @@ -0,0 +1,23 @@ +# check the timestamps, might want to preserve the old ones +- name: Backup OS provided Firmware + copy: + src: "/lib/firmware/brcm/{{ item }}" + dest: "/lib/firmware/brcm/{{ item }}.orig" + with_items: + - brcmfmac43430-sdio.bin + - brcmfmac43455-sdio.bin + +# grab the old firmware +- name: Retrieve older firmware + get_url: + url: "{{ item.url }}" + dest: "{{ item.dest }}" + with_items: + - { url: 'http://download.iiab.io/packages/brcmfmac43430-sdio.bin_2020-02-16_7.45.98.97' dest:/lib/firmware/brcm/brcmfmac43430-sdio.bin_iiab } + - { url: 'http://download.iiab.io/packages/brcmfmac43455-sdio.bin_2015-03-01_7.45.18.0_ub19.10.1' dest: '/lib/firmware/brcm/brcmfmac43455-sdio.bin_iiab' } + +- name: "Add 'firmware_retrieved: True' to {{ iiab_state_file }}" + lineinfile: + path: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml + regexp: '^RPi_firmware_retrieved' + line: 'RPi_firmware_retrieved: True' diff --git a/roles/firmware/tasks/main.yml b/roles/firmware/tasks/main.yml new file mode 100644 index 000000000..0a6ca75bb --- /dev/null +++ b/roles/firmware/tasks/main.yml @@ -0,0 +1,20 @@ +- name: Include older RPi Firmware + include_tasks: install.yml + when: RPi_firmware_retrieved is undefined + +- name: Install check-firmware service files + template: + src: "{{ item.src }}" + dest: "{{ item.dest }}" + mode: "{{ item.mode }}" + with_items: + - { src: 'fw-warn.sh', dest: '/usr/sbin/' mode: '0644' } + - { src: 'check-firmware.service', dest: '/etc/systemd/system/' mode: '0644'} + - { src: 'check-firmware.sh', dest: '/usr/sbin/' mode: '0755' } + +- name: Enable and Start check-firmware.service + systemd: + name: check-firmware.service + state: reloaded + enabled: yes + status: started diff --git a/roles/firmware/templates/check-firmware.service b/roles/firmware/templates/check-firmware.service new file mode 100644 index 000000000..3181897df --- /dev/null +++ b/roles/firmware/templates/check-firmware.service @@ -0,0 +1,11 @@ +[Unit] +Description=Check Firmware service +Before=clone-wifi.service + +[Service] +Type=oneshot +ExecStart=/usr/sbin/check-firmware + +[Install] +WantedBy=multi-user.target + diff --git a/roles/firmware/templates/check-firmware.sh b/roles/firmware/templates/check-firmware.sh new file mode 100644 index 000000000..7a0bc5d9c --- /dev/null +++ b/roles/firmware/templates/check-firmware.sh @@ -0,0 +1,22 @@ +#!/bin/bash +FW_MODE=$(grep wifi_hotspot_capacity_rpi_fix /etc/iiab/local_vars.yml| grep True) +WARN=0 +if [ -z "$FW_MODE" ]; then + echo "FW marker not found" +else + echo "$FW_MODE" + if ! $(diff -q /lib/firmware/brcm/brcmfmac43455-sdio.bin.iiab /lib/firmware/brcm/brcmfmac43455-sdio.bin); then + cp /lib/firmware/brcm/brcmfmac43455-sdio.bin.iiab /lib/firmware/brcm/brcmfmac43455-sdio.bin + WARN=1 + fi + if ! $(diff -q /lib/firmware/brcm/brcmfmac43430-sdio.bin.iiab /lib/firmware/brcm/brcmfmac43430-sdio.bin); then + cp /lib/firmware/brcm/brcmfmac43430-sdio.bin.iiab /lib/firmware/brcm/brcmfmac43430-sdio.bin + WARN=1 + fi +fi +if [ "$WARN" = "1" ] + touch /.fw_replaced +else + rm /.fw_replaced +fi +exit 0 diff --git a/roles/firmware/templates/fw_warn.sh b/roles/firmware/templates/fw_warn.sh new file mode 100644 index 000000000..c6a6e2bfe --- /dev/null +++ b/roles/firmware/templates/fw_warn.sh @@ -0,0 +1,6 @@ +#!/bin/bash +if [ -f /.fw_replaced ]; then + echo -e " \033[31;5mFirmware has been replaced\033[0m" + echo -e " \033[31;5mReboot is required to activate\033[0m" +fi + diff --git a/roles/network/tasks/main.yml b/roles/network/tasks/main.yml index 1ffc904d0..35bd3c66d 100644 --- a/roles/network/tasks/main.yml +++ b/roles/network/tasks/main.yml @@ -1,3 +1,8 @@ +- name: Select RPi firmware mode + include_role: + name: firmware + when: rpi_model != "none" + - name: detected_network include_tasks: detected_network.yml From bb003ea3008d2c13599534ff3b3bb1ee73d2fc81 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sun, 2 Aug 2020 13:47:52 -0500 Subject: [PATCH 05/29] use same file extention --- roles/firmware/tasks/install.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/firmware/tasks/install.yml b/roles/firmware/tasks/install.yml index 0bfe74f63..c4c5bdce7 100644 --- a/roles/firmware/tasks/install.yml +++ b/roles/firmware/tasks/install.yml @@ -13,8 +13,8 @@ url: "{{ item.url }}" dest: "{{ item.dest }}" with_items: - - { url: 'http://download.iiab.io/packages/brcmfmac43430-sdio.bin_2020-02-16_7.45.98.97' dest:/lib/firmware/brcm/brcmfmac43430-sdio.bin_iiab } - - { url: 'http://download.iiab.io/packages/brcmfmac43455-sdio.bin_2015-03-01_7.45.18.0_ub19.10.1' dest: '/lib/firmware/brcm/brcmfmac43455-sdio.bin_iiab' } + - { url: 'http://download.iiab.io/packages/brcmfmac43430-sdio.bin_2020-02-16_7.45.98.97' dest:/lib/firmware/brcm/brcmfmac43430-sdio.bin.iiab } + - { url: 'http://download.iiab.io/packages/brcmfmac43455-sdio.bin_2015-03-01_7.45.18.0_ub19.10.1' dest: '/lib/firmware/brcm/brcmfmac43455-sdio.bin.iiab' } - name: "Add 'firmware_retrieved: True' to {{ iiab_state_file }}" lineinfile: From 5ab2eaabe00caa1ebcd7a1e7ea32475fc703aa87 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sun, 2 Aug 2020 13:54:59 -0500 Subject: [PATCH 06/29] forgot file extention --- roles/firmware/templates/check-firmware.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/firmware/templates/check-firmware.service b/roles/firmware/templates/check-firmware.service index 3181897df..077e3ab8a 100644 --- a/roles/firmware/templates/check-firmware.service +++ b/roles/firmware/templates/check-firmware.service @@ -4,7 +4,7 @@ Before=clone-wifi.service [Service] Type=oneshot -ExecStart=/usr/sbin/check-firmware +ExecStart=/usr/sbin/check-firmware.sh [Install] WantedBy=multi-user.target From 888dc4dbeb930aa10e1eabdce17ce6bdf61acc69 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sun, 2 Aug 2020 15:48:17 -0500 Subject: [PATCH 07/29] Update roles/firmware/tasks/install.yml Co-authored-by: A Holt --- roles/firmware/tasks/install.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/firmware/tasks/install.yml b/roles/firmware/tasks/install.yml index c4c5bdce7..e1d3f1b6c 100644 --- a/roles/firmware/tasks/install.yml +++ b/roles/firmware/tasks/install.yml @@ -13,7 +13,7 @@ url: "{{ item.url }}" dest: "{{ item.dest }}" with_items: - - { url: 'http://download.iiab.io/packages/brcmfmac43430-sdio.bin_2020-02-16_7.45.98.97' dest:/lib/firmware/brcm/brcmfmac43430-sdio.bin.iiab } + - { url: 'http://download.iiab.io/packages/brcmfmac43430-sdio.bin_2018-09-11_7.45.98.65' dest: '/lib/firmware/brcm/brcmfmac43430-sdio.bin.iiab' } - { url: 'http://download.iiab.io/packages/brcmfmac43455-sdio.bin_2015-03-01_7.45.18.0_ub19.10.1' dest: '/lib/firmware/brcm/brcmfmac43455-sdio.bin.iiab' } - name: "Add 'firmware_retrieved: True' to {{ iiab_state_file }}" From 77dd01521311d031047547bd2e273e6ad3f7dac4 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sun, 2 Aug 2020 15:48:47 -0500 Subject: [PATCH 08/29] Update roles/firmware/tasks/main.yml Co-authored-by: A Holt --- roles/firmware/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/firmware/tasks/main.yml b/roles/firmware/tasks/main.yml index 0a6ca75bb..72ae65bb6 100644 --- a/roles/firmware/tasks/main.yml +++ b/roles/firmware/tasks/main.yml @@ -8,7 +8,7 @@ dest: "{{ item.dest }}" mode: "{{ item.mode }}" with_items: - - { src: 'fw-warn.sh', dest: '/usr/sbin/' mode: '0644' } + - { src: 'fw-warn.sh', dest: '/usr/sbin/', mode: '0644' } - { src: 'check-firmware.service', dest: '/etc/systemd/system/' mode: '0644'} - { src: 'check-firmware.sh', dest: '/usr/sbin/' mode: '0755' } From 87c82b84d19d6add0636f2734445e2cda7891280 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sun, 2 Aug 2020 15:49:00 -0500 Subject: [PATCH 09/29] Update roles/firmware/tasks/main.yml Co-authored-by: A Holt --- roles/firmware/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/firmware/tasks/main.yml b/roles/firmware/tasks/main.yml index 72ae65bb6..601f5798e 100644 --- a/roles/firmware/tasks/main.yml +++ b/roles/firmware/tasks/main.yml @@ -9,7 +9,7 @@ mode: "{{ item.mode }}" with_items: - { src: 'fw-warn.sh', dest: '/usr/sbin/', mode: '0644' } - - { src: 'check-firmware.service', dest: '/etc/systemd/system/' mode: '0644'} + - { src: 'check-firmware.service', dest: '/etc/systemd/system/', mode: '0644' } - { src: 'check-firmware.sh', dest: '/usr/sbin/' mode: '0755' } - name: Enable and Start check-firmware.service From 39cf0601d2056a1ed38154ee3499be316d7dd7ba Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sun, 2 Aug 2020 15:49:13 -0500 Subject: [PATCH 10/29] Update roles/firmware/tasks/main.yml Co-authored-by: A Holt --- roles/firmware/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/firmware/tasks/main.yml b/roles/firmware/tasks/main.yml index 601f5798e..16ff86882 100644 --- a/roles/firmware/tasks/main.yml +++ b/roles/firmware/tasks/main.yml @@ -10,7 +10,7 @@ with_items: - { src: 'fw-warn.sh', dest: '/usr/sbin/', mode: '0644' } - { src: 'check-firmware.service', dest: '/etc/systemd/system/', mode: '0644' } - - { src: 'check-firmware.sh', dest: '/usr/sbin/' mode: '0755' } + - { src: 'check-firmware.sh', dest: '/usr/sbin/', mode: '0755' } - name: Enable and Start check-firmware.service systemd: From d4e396362ecd5935af31d03111323877e7f3a4b4 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sun, 2 Aug 2020 15:57:03 -0500 Subject: [PATCH 11/29] correct path and file name --- roles/firmware/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/firmware/tasks/main.yml b/roles/firmware/tasks/main.yml index 16ff86882..0fe051b09 100644 --- a/roles/firmware/tasks/main.yml +++ b/roles/firmware/tasks/main.yml @@ -8,7 +8,7 @@ dest: "{{ item.dest }}" mode: "{{ item.mode }}" with_items: - - { src: 'fw-warn.sh', dest: '/usr/sbin/', mode: '0644' } + - { src: 'fw_warn.sh', dest: '/etc/profile.d/', mode: '0644' } - { src: 'check-firmware.service', dest: '/etc/systemd/system/', mode: '0644' } - { src: 'check-firmware.sh', dest: '/usr/sbin/', mode: '0755' } From 0a747b152967f1438d625424af876c9686869135 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Sun, 2 Aug 2020 16:19:24 -0500 Subject: [PATCH 12/29] add clm_blob and adjust --- roles/firmware/tasks/install.yml | 5 +++-- roles/firmware/templates/check-firmware.sh | 12 +++++++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/roles/firmware/tasks/install.yml b/roles/firmware/tasks/install.yml index e1d3f1b6c..b50a94acb 100644 --- a/roles/firmware/tasks/install.yml +++ b/roles/firmware/tasks/install.yml @@ -13,8 +13,9 @@ url: "{{ item.url }}" dest: "{{ item.dest }}" with_items: - - { url: 'http://download.iiab.io/packages/brcmfmac43430-sdio.bin_2018-09-11_7.45.98.65' dest: '/lib/firmware/brcm/brcmfmac43430-sdio.bin.iiab' } - - { url: 'http://download.iiab.io/packages/brcmfmac43455-sdio.bin_2015-03-01_7.45.18.0_ub19.10.1' dest: '/lib/firmware/brcm/brcmfmac43455-sdio.bin.iiab' } + - { url: 'http://d.iiab.io/packages/brcmfmac43430-sdio.clm_blob_2018-09-11_7.45.98.65', dest: '/lib/firmware/brcm/brcmfmac43430-sdio.clm_blob.iiab' } + - { url: 'http://d.iiab.io/packages/brcmfmac43430-sdio.bin_2018-09-11_7.45.98.65', dest: '/lib/firmware/brcm/brcmfmac43430-sdio.bin.iiab' } + - { url: 'http://d.iiab.io/packages/brcmfmac43455-sdio.bin_2015-03-01_7.45.18.0_ub19.10.1', dest: '/lib/firmware/brcm/brcmfmac43455-sdio.bin.iiab' } - name: "Add 'firmware_retrieved: True' to {{ iiab_state_file }}" lineinfile: diff --git a/roles/firmware/templates/check-firmware.sh b/roles/firmware/templates/check-firmware.sh index 7a0bc5d9c..5704ca566 100644 --- a/roles/firmware/templates/check-firmware.sh +++ b/roles/firmware/templates/check-firmware.sh @@ -7,15 +7,25 @@ else echo "$FW_MODE" if ! $(diff -q /lib/firmware/brcm/brcmfmac43455-sdio.bin.iiab /lib/firmware/brcm/brcmfmac43455-sdio.bin); then cp /lib/firmware/brcm/brcmfmac43455-sdio.bin.iiab /lib/firmware/brcm/brcmfmac43455-sdio.bin + echo "replacing firmware" WARN=1 fi if ! $(diff -q /lib/firmware/brcm/brcmfmac43430-sdio.bin.iiab /lib/firmware/brcm/brcmfmac43430-sdio.bin); then cp /lib/firmware/brcm/brcmfmac43430-sdio.bin.iiab /lib/firmware/brcm/brcmfmac43430-sdio.bin + echo "replacing firmware" + WARN=1 + fi + if ! $(diff -q /lib/firmware/brcm/brcmfmac43430-sdio.clm_blob.iiab /lib/firmware/brcm/brcmfmac43430-sdio.clm_blob); then + cp /lib/firmware/brcm/brcmfmac43430-sdio.clm_blob.iiab /lib/firmware/brcm/brcmfmac43430-sdio.clm_blob + echo "replacing firmware" WARN=1 fi fi -if [ "$WARN" = "1" ] +if [ "$WARN" = "1" ]; then + echo "You should reboot now" touch /.fw_replaced + #echo "rebooting..." + #reboot else rm /.fw_replaced fi From 5304bcdfa1014ab2e1fd6b0337d1023063e20b53 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Mon, 3 Aug 2020 04:06:17 -0500 Subject: [PATCH 13/29] first run file absent --- roles/firmware/templates/check-firmware.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/firmware/templates/check-firmware.sh b/roles/firmware/templates/check-firmware.sh index 5704ca566..c201d5443 100644 --- a/roles/firmware/templates/check-firmware.sh +++ b/roles/firmware/templates/check-firmware.sh @@ -12,6 +12,7 @@ else fi if ! $(diff -q /lib/firmware/brcm/brcmfmac43430-sdio.bin.iiab /lib/firmware/brcm/brcmfmac43430-sdio.bin); then cp /lib/firmware/brcm/brcmfmac43430-sdio.bin.iiab /lib/firmware/brcm/brcmfmac43430-sdio.bin + cp /lib/firmware/brcm/brcmfmac43430-sdio.clm_blob.iiab /lib/firmware/brcm/brcmfmac43430-sdio.clm_blob echo "replacing firmware" WARN=1 fi From daa4c64936aa50a6fe0683a4f79347b04c1d1a83 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Mon, 3 Aug 2020 09:56:58 -0500 Subject: [PATCH 14/29] add 43455-clm_blob and backup --- roles/firmware/tasks/install.yml | 2 ++ roles/firmware/templates/check-firmware.sh | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/roles/firmware/tasks/install.yml b/roles/firmware/tasks/install.yml index b50a94acb..bcc7b496d 100644 --- a/roles/firmware/tasks/install.yml +++ b/roles/firmware/tasks/install.yml @@ -6,6 +6,7 @@ with_items: - brcmfmac43430-sdio.bin - brcmfmac43455-sdio.bin + - brcmfmac43455-sdio.clm_blob # grab the old firmware - name: Retrieve older firmware @@ -16,6 +17,7 @@ - { url: 'http://d.iiab.io/packages/brcmfmac43430-sdio.clm_blob_2018-09-11_7.45.98.65', dest: '/lib/firmware/brcm/brcmfmac43430-sdio.clm_blob.iiab' } - { url: 'http://d.iiab.io/packages/brcmfmac43430-sdio.bin_2018-09-11_7.45.98.65', dest: '/lib/firmware/brcm/brcmfmac43430-sdio.bin.iiab' } - { url: 'http://d.iiab.io/packages/brcmfmac43455-sdio.bin_2015-03-01_7.45.18.0_ub19.10.1', dest: '/lib/firmware/brcm/brcmfmac43455-sdio.bin.iiab' } + - { url: 'http://d.iiab.io/packages/brcmfmac43455-sdio.clm_blob_2018-02-26_rpi', dest: '/lib/firmware/brcm/brcmfmac43455-sdio.clm_blob.iiab' } - name: "Add 'firmware_retrieved: True' to {{ iiab_state_file }}" lineinfile: diff --git a/roles/firmware/templates/check-firmware.sh b/roles/firmware/templates/check-firmware.sh index c201d5443..88dd76715 100644 --- a/roles/firmware/templates/check-firmware.sh +++ b/roles/firmware/templates/check-firmware.sh @@ -1,22 +1,32 @@ #!/bin/bash FW_MODE=$(grep wifi_hotspot_capacity_rpi_fix /etc/iiab/local_vars.yml| grep True) WARN=0 +DATE=$(date +%F-%T) if [ -z "$FW_MODE" ]; then echo "FW marker not found" else echo "$FW_MODE" if ! $(diff -q /lib/firmware/brcm/brcmfmac43455-sdio.bin.iiab /lib/firmware/brcm/brcmfmac43455-sdio.bin); then + mv /lib/firmware/brcm/brcmfmac43455-sdio.bin /lib/firmware/brcm/brcmfmac43455-sdio.bin.$DATE cp /lib/firmware/brcm/brcmfmac43455-sdio.bin.iiab /lib/firmware/brcm/brcmfmac43455-sdio.bin echo "replacing firmware" WARN=1 fi + if ! $(diff -q /lib/firmware/brcm/brcmfmac43455-sdio.clm_blob.iiab /lib/firmware/brcm/brcmfmac43455-sdio.clm_blob); then + mv /lib/firmware/brcm/brcmfmac43455-sdio.clm_blob /lib/firmware/brcm/brcmfmac43455-sdio.clm_blob.$DATE + cp /lib/firmware/brcm/brcmfmac43455-sdio.clm_blob.iiab /lib/firmware/brcm/brcmfmac43455-sdio.clm_blob + echo "replacing firmware" + WARN=1 + fi if ! $(diff -q /lib/firmware/brcm/brcmfmac43430-sdio.bin.iiab /lib/firmware/brcm/brcmfmac43430-sdio.bin); then + mv /lib/firmware/brcm/brcmfmac43430-sdio.bin /lib/firmware/brcm/brcmfmac43430-sdio.bin.$DATE cp /lib/firmware/brcm/brcmfmac43430-sdio.bin.iiab /lib/firmware/brcm/brcmfmac43430-sdio.bin cp /lib/firmware/brcm/brcmfmac43430-sdio.clm_blob.iiab /lib/firmware/brcm/brcmfmac43430-sdio.clm_blob echo "replacing firmware" WARN=1 fi if ! $(diff -q /lib/firmware/brcm/brcmfmac43430-sdio.clm_blob.iiab /lib/firmware/brcm/brcmfmac43430-sdio.clm_blob); then + mv /lib/firmware/brcm/brcmfmac43430-sdio.clm_blob /lib/firmware/brcm/brcmfmac43430-sdio.clm_blob.$DATE cp /lib/firmware/brcm/brcmfmac43430-sdio.clm_blob.iiab /lib/firmware/brcm/brcmfmac43430-sdio.clm_blob echo "replacing firmware" WARN=1 From a8a117cdf2dbf479208c34d45454668f98975981 Mon Sep 17 00:00:00 2001 From: A Holt Date: Wed, 5 Aug 2020 13:57:58 -0400 Subject: [PATCH 15/29] Update runrole --- runrole | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/runrole b/runrole index cb8189a60..4edc63f6a 100755 --- a/runrole +++ b/runrole @@ -34,10 +34,21 @@ fi # exit 1 #fi +# 2020-08-05: yes /etc/iiab/iiab_state.yml is necessary, but we DON'T +# want to encourage sloppy operators to delete/touch this file. +# +# (The iiab_state.yml file should always be created by ./iiab-install, +# for IIAB's Ansible roles that then auto-populate this file.) +# +# FYI iiab-network and iiab-configure likewise warn operators (IN RED!) +# if they try to run without the existence of /etc/iiab/iiab_state.yml : +# +# ERROR! vars file /etc/iiab/iiab_state.yml was not found +# # Needed for Stages 1-3 if not installed yet -if [ ! -f $IIAB_STATE_FILE ]; then - touch $IIAB_STATE_FILE -fi +#if [ ! -f $IIAB_STATE_FILE ]; then +# touch $IIAB_STATE_FILE +#fi #if ! grep -q $1_install $LOCAL_VARS_FILE; then # echo " $1_install: not found in $VARS" From 0280d02a0b42fff102095eb00ed185357ead3e72 Mon Sep 17 00:00:00 2001 From: A Holt Date: Wed, 5 Aug 2020 13:59:34 -0400 Subject: [PATCH 16/29] Update iiab-install --- iiab-install | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/iiab-install b/iiab-install index 8a4a18560..665f3edd5 100755 --- a/iiab-install +++ b/iiab-install @@ -178,7 +178,12 @@ fi # Allow iiab-install to read IIAB_STATE_FILE to not repeat installs of previous # roles that already completed within the stage. if [ ! -f $IIAB_STATE_FILE ]; then - touch $IIAB_STATE_FILE + #touch $IIAB_STATE_FILE + cat > $IIAB_STATE_FILE << EOF +# DO *NOT* MANUALLY EDIT THIS, THANKS! +# IIAB does NOT currently support uninstalling apps. + +EOF fi echo -e "\nTRY TO RERUN './iiab-install' IF IT FAILS DUE TO CONNECTIVITY ISSUES ETC!\n" From 97f91177c86f5d15fe95059d43daacaaeb404660 Mon Sep 17 00:00:00 2001 From: A Holt Date: Wed, 5 Aug 2020 14:06:25 -0400 Subject: [PATCH 17/29] Update iiab-install --- iiab-install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iiab-install b/iiab-install index 665f3edd5..6eeac2db6 100755 --- a/iiab-install +++ b/iiab-install @@ -181,7 +181,7 @@ if [ ! -f $IIAB_STATE_FILE ]; then #touch $IIAB_STATE_FILE cat > $IIAB_STATE_FILE << EOF # DO *NOT* MANUALLY EDIT THIS, THANKS! -# IIAB does NOT currently support uninstalling apps. +# IIAB does NOT currently support uninstalling apps/services. EOF fi From 853ddf1a1ace3afe865443bc4a4a3d180cbbf629 Mon Sep 17 00:00:00 2001 From: A Holt Date: Wed, 5 Aug 2020 14:17:58 -0400 Subject: [PATCH 18/29] Remove legacy code from iiab-install --- iiab-install | 31 +------------------------------ 1 file changed, 1 insertion(+), 30 deletions(-) diff --git a/iiab-install b/iiab-install index 6eeac2db6..261893cf3 100755 --- a/iiab-install +++ b/iiab-install @@ -145,36 +145,7 @@ if [ "$STAGE" -lt 2 ] && [ "$1" == "--debug" ]; then echo -e "\n'--debug' *ignored* as STAGE (counter) < 2." fi -# TEMPORARY: Catch images up to current code to benefit from pre-installed apps -# Workaround for (web-published) images; will go away later -# Assumes /etc/iiab/iiab_state.yml is not created until (prior run of) Stage 4 but -# config_vars2.yml is present with the stage counter altered by pi-gen to be 2. -if [ -f /etc/iiab/config_vars2.yml ]; then - mv /etc/iiab/config_vars2.yml $IIAB_STATE_FILE - -# Fix up prior values in state file -# mongo role improved post image creation - if grep -q sugar $IIAB_STATE_FILE && ! grep -q mongodb $IIAB_STATE_FILE; then - echo "mongodb_installed: True" >> $IIAB_STATE_FILE - fi - -# TEMPORARY: another change to account for -# sed -i -e 's/pan_bluetooth/bluetooth/' $IIAB_STATE_FILE - - if [ "$STAGE" -eq 2 ]; then - echo -e "\nCompleting Stage 3 from IIAB image (starts systemd service iiab-setup-db to run the 'mysql' role)." - systemctl start iiab-setup-db - fi - - PLAYBOOK="iiab-from-console.yml" # Stage 4-9 then Network Role - ARGS="" # Removes '--extra-vars reinstall=True' if --reinstall, BUT WHY? -# The same as --reinstall except Stage 3 is not run as there are no other functional -# changes in Stage 3 to account for post image creation, once the above is run. -# reinstall=True would force kiwix to re-download and re-install in commit -# ce2ec3b0cad76449caf3299003b5d297a3164181 -## End image catch up -fi - +# /etc/iiab/iiab_state.yml is mandatory and must be created here. Background: # Allow iiab-install to read IIAB_STATE_FILE to not repeat installs of previous # roles that already completed within the stage. if [ ! -f $IIAB_STATE_FILE ]; then From 2357a9eed1362e4d69d4e9bf20210a0652d2f81d Mon Sep 17 00:00:00 2001 From: A Holt Date: Wed, 5 Aug 2020 14:20:02 -0400 Subject: [PATCH 19/29] Update runrole --- runrole | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runrole b/runrole index 4edc63f6a..b1615bf43 100755 --- a/runrole +++ b/runrole @@ -40,7 +40,7 @@ fi # (The iiab_state.yml file should always be created by ./iiab-install, # for IIAB's Ansible roles that then auto-populate this file.) # -# FYI iiab-network and iiab-configure likewise warn operators (IN RED!) +# FYI ./iiab-network and ./iiab-configure likewise warn operators (IN RED!) # if they try to run without the existence of /etc/iiab/iiab_state.yml : # # ERROR! vars file /etc/iiab/iiab_state.yml was not found From 6e284ee493553fb39078fe084afe68711dc8edb0 Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Wed, 5 Aug 2020 14:21:40 -0500 Subject: [PATCH 20/29] daemon_reload --- roles/firmware/tasks/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/firmware/tasks/main.yml b/roles/firmware/tasks/main.yml index 0fe051b09..2d493c259 100644 --- a/roles/firmware/tasks/main.yml +++ b/roles/firmware/tasks/main.yml @@ -15,6 +15,6 @@ - name: Enable and Start check-firmware.service systemd: name: check-firmware.service - state: reloaded + daemon_reload: yes + state: restarted enabled: yes - status: started From 21dad03c4a619508b932c1119d70a50aace0266a Mon Sep 17 00:00:00 2001 From: A Holt Date: Wed, 5 Aug 2020 15:47:49 -0400 Subject: [PATCH 21/29] Update default_vars.yml --- vars/default_vars.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vars/default_vars.yml b/vars/default_vars.yml index e2bb37e3c..f7cfa19a8 100644 --- a/vars/default_vars.yml +++ b/vars/default_vars.yml @@ -95,7 +95,10 @@ hostapd_secure: False hostapd_password: changeme hostapd_install: True # 2020-01-21: this var MIGHT be implemented in future. hostapd_enabled: True -wifi_up_down: True # Creates a 2nd virtual wifi adapter for upstream WiFi +wifi_hotspot_capacity_rpi_fix: True # Restores the ability of RPi internal +# WiFi hotspots to service 30-to-32 client devices. Background explanation: +# https://github.com/iiab/iiab/issues/823#issuecomment-662285202 and PR #2472. +wifi_up_down: True # Creates a 2nd virtual WiFi adapter for upstream WiFi # (e.g. to Internet) in addition to downstream WiFi (e.g. classroom hotspot). # You can set iiab_gateway_enabled below, to enable "passthrough" to Internet. From 09cdf28643542d56b4bc31ecf3dc679d7e484d97 Mon Sep 17 00:00:00 2001 From: A Holt Date: Wed, 5 Aug 2020 15:47:55 -0400 Subject: [PATCH 22/29] Update local_vars_min.yml --- vars/local_vars_min.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vars/local_vars_min.yml b/vars/local_vars_min.yml index f32591746..cbb15ad7d 100644 --- a/vars/local_vars_min.yml +++ b/vars/local_vars_min.yml @@ -46,7 +46,10 @@ host_wifi_mode: g host_channel: 6 hostapd_secure: False hostapd_password: changeme -wifi_up_down: True # Creates a 2nd virtual wifi adapter for upstream WiFi +wifi_hotspot_capacity_rpi_fix: True # Restores the ability of RPi internal +# WiFi hotspots to service 30-to-32 client devices. Background explanation: +# https://github.com/iiab/iiab/issues/823#issuecomment-662285202 and PR #2472. +wifi_up_down: True # Creates a 2nd virtual WiFi adapter for upstream WiFi # (e.g. to Internet) in addition to downstream WiFi (e.g. classroom hotspot). # You can set iiab_gateway_enabled below, to enable "passthrough" to Internet. From 4cd6fac3274f0c66cd5cb181d8dd983f873e083a Mon Sep 17 00:00:00 2001 From: A Holt Date: Wed, 5 Aug 2020 15:48:01 -0400 Subject: [PATCH 23/29] Update local_vars_medium.yml --- vars/local_vars_medium.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vars/local_vars_medium.yml b/vars/local_vars_medium.yml index f4f5f7464..9f619aa84 100644 --- a/vars/local_vars_medium.yml +++ b/vars/local_vars_medium.yml @@ -46,7 +46,10 @@ host_wifi_mode: g host_channel: 6 hostapd_secure: False hostapd_password: changeme -wifi_up_down: True # Creates a 2nd virtual wifi adapter for upstream WiFi +wifi_hotspot_capacity_rpi_fix: True # Restores the ability of RPi internal +# WiFi hotspots to service 30-to-32 client devices. Background explanation: +# https://github.com/iiab/iiab/issues/823#issuecomment-662285202 and PR #2472. +wifi_up_down: True # Creates a 2nd virtual WiFi adapter for upstream WiFi # (e.g. to Internet) in addition to downstream WiFi (e.g. classroom hotspot). # You can set iiab_gateway_enabled below, to enable "passthrough" to Internet. From 438fe4755dff09aab4db954cf2cde87a9affcd12 Mon Sep 17 00:00:00 2001 From: A Holt Date: Wed, 5 Aug 2020 15:48:10 -0400 Subject: [PATCH 24/29] Update local_vars_big.yml --- vars/local_vars_big.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vars/local_vars_big.yml b/vars/local_vars_big.yml index 2b859b4bd..7be6d4ba9 100644 --- a/vars/local_vars_big.yml +++ b/vars/local_vars_big.yml @@ -46,7 +46,10 @@ host_wifi_mode: g host_channel: 6 hostapd_secure: False hostapd_password: changeme -wifi_up_down: True # Creates a 2nd virtual wifi adapter for upstream WiFi +wifi_hotspot_capacity_rpi_fix: True # Restores the ability of RPi internal +# WiFi hotspots to service 30-to-32 client devices. Background explanation: +# https://github.com/iiab/iiab/issues/823#issuecomment-662285202 and PR #2472. +wifi_up_down: True # Creates a 2nd virtual WiFi adapter for upstream WiFi # (e.g. to Internet) in addition to downstream WiFi (e.g. classroom hotspot). # You can set iiab_gateway_enabled below, to enable "passthrough" to Internet. From fb9a0da40e751bf44388f6299e6cfea5238e0344 Mon Sep 17 00:00:00 2001 From: A Holt Date: Wed, 5 Aug 2020 16:22:09 -0400 Subject: [PATCH 25/29] Update iiab-diagnostics --- scripts/iiab-diagnostics | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/iiab-diagnostics b/scripts/iiab-diagnostics index bb74c0414..683463218 100755 --- a/scripts/iiab-diagnostics +++ b/scripts/iiab-diagnostics @@ -234,10 +234,11 @@ read ans < /dev/tty echo -e "\e[1m" if [ "$ans" == "" ] || [ "$ans" == "y" ] || [ "$ans" == "Y" ]; then echo -ne "PUBLISHING TO URL... " - pastebinit -b dpaste.com < $outfile # Run 'pastebinit -l' to list other possible pastebin site URLs + #pastebinit -b dpaste.com < $outfile + pastebinit -b sprunge.us < $outfile # Run 'pastebinit -l' to list other possible pastebin site URLs else echo -e "If you later decide to publish it, run:" echo - echo -e " pastebinit -b dpaste.com < $outfile" + echo -e " pastebinit -b sprunge.us < $outfile" fi echo -e "\e[0m" From c1912bd15004e7815954476db8e8e5fe56fb7cac Mon Sep 17 00:00:00 2001 From: A Holt Date: Wed, 5 Aug 2020 16:23:24 -0400 Subject: [PATCH 26/29] Update iiab-diagnostics.README.md --- scripts/iiab-diagnostics.README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/iiab-diagnostics.README.md b/scripts/iiab-diagnostics.README.md index 4a6c8e318..a23809d21 100644 --- a/scripts/iiab-diagnostics.README.md +++ b/scripts/iiab-diagnostics.README.md @@ -49,7 +49,7 @@ But first off, the file is compiled by harvesting 1 + 6 kinds of things: Or, you can later/manually upload it using the ``pastebinit`` command: ``` - pastebinit -b dpaste.com < /etc/iiab/diag/NEW-FILE-NAME + pastebinit -b sprunge.us < /etc/iiab/diag/NEW-FILE-NAME ``` Either way, this will generate an actual web link (URL). From ebe326b9141164d67c98f27b17565919af6a9874 Mon Sep 17 00:00:00 2001 From: A Holt Date: Wed, 5 Aug 2020 16:29:01 -0400 Subject: [PATCH 27/29] Update iiab-diagnostics.README.md --- scripts/iiab-diagnostics.README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/iiab-diagnostics.README.md b/scripts/iiab-diagnostics.README.md index a23809d21..1a6353ad5 100644 --- a/scripts/iiab-diagnostics.README.md +++ b/scripts/iiab-diagnostics.README.md @@ -62,4 +62,4 @@ But first off, the file is compiled by harvesting 1 + 6 kinds of things: ## Source Code -Please look over the bottom of [iiab-diagnostics](iiab-diagnostics) (lines 105-218 especially) to learn more about which common IIAB files and commands make this rapid troubleshooting possible. +Please look over the bottom of [iiab-diagnostics](iiab-diagnostics) (lines 106-218 especially) to learn more about which common IIAB files and commands make this rapid troubleshooting possible. From 18cd3c8d1bf39c32baaf3bd4f7164dfd03d8c6bf Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Thu, 6 Aug 2020 10:38:20 -0500 Subject: [PATCH 28/29] file test before remove --- roles/firmware/templates/check-firmware.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/roles/firmware/templates/check-firmware.sh b/roles/firmware/templates/check-firmware.sh index 88dd76715..430050dc3 100644 --- a/roles/firmware/templates/check-firmware.sh +++ b/roles/firmware/templates/check-firmware.sh @@ -38,6 +38,8 @@ if [ "$WARN" = "1" ]; then #echo "rebooting..." #reboot else - rm /.fw_replaced + if [ -f /.fw_replaced ]; then + rm /.fw_replaced + fi fi exit 0 From ee57061bed5bca22fedce80574acf3a34c73398e Mon Sep 17 00:00:00 2001 From: Jerry Vonau Date: Thu, 6 Aug 2020 11:06:15 -0500 Subject: [PATCH 29/29] add color --- roles/firmware/templates/check-firmware.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/roles/firmware/templates/check-firmware.sh b/roles/firmware/templates/check-firmware.sh index 430050dc3..e83d7756e 100644 --- a/roles/firmware/templates/check-firmware.sh +++ b/roles/firmware/templates/check-firmware.sh @@ -33,11 +33,13 @@ else fi fi if [ "$WARN" = "1" ]; then - echo "You should reboot now" + echo -e " \033[31;5mFirmware has been replaced\033[0m" + echo -e " \033[31;5mReboot is required to activate\033[0m" touch /.fw_replaced #echo "rebooting..." #reboot else + echo -e " Firmware check \033[32;5mPASSED\033[0m" if [ -f /.fw_replaced ]; then rm /.fw_replaced fi