mirror of
https://github.com/iiab/iiab.git
synced 2025-03-09 15:40:17 +00:00
commit
1a2c22ea01
17 changed files with 175 additions and 56 deletions
38
iiab-install
38
iiab-install
|
@ -145,40 +145,16 @@ 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
|
||||
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/services.
|
||||
|
||||
EOF
|
||||
fi
|
||||
echo -e "\nTRY TO RERUN './iiab-install' IF IT FAILS DUE TO CONNECTIVITY ISSUES ETC!\n"
|
||||
|
||||
|
|
26
roles/firmware/tasks/install.yml
Normal file
26
roles/firmware/tasks/install.yml
Normal file
|
@ -0,0 +1,26 @@
|
|||
# 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
|
||||
- brcmfmac43455-sdio.clm_blob
|
||||
|
||||
# grab the old firmware
|
||||
- name: Retrieve older firmware
|
||||
get_url:
|
||||
url: "{{ item.url }}"
|
||||
dest: "{{ item.dest }}"
|
||||
with_items:
|
||||
- { 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:
|
||||
path: "{{ iiab_state_file }}" # /etc/iiab/iiab_state.yml
|
||||
regexp: '^RPi_firmware_retrieved'
|
||||
line: 'RPi_firmware_retrieved: True'
|
20
roles/firmware/tasks/main.yml
Normal file
20
roles/firmware/tasks/main.yml
Normal file
|
@ -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: '/etc/profile.d/', 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
|
||||
daemon_reload: yes
|
||||
state: restarted
|
||||
enabled: yes
|
11
roles/firmware/templates/check-firmware.service
Normal file
11
roles/firmware/templates/check-firmware.service
Normal file
|
@ -0,0 +1,11 @@
|
|||
[Unit]
|
||||
Description=Check Firmware service
|
||||
Before=clone-wifi.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/sbin/check-firmware.sh
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
47
roles/firmware/templates/check-firmware.sh
Normal file
47
roles/firmware/templates/check-firmware.sh
Normal file
|
@ -0,0 +1,47 @@
|
|||
#!/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
|
||||
fi
|
||||
fi
|
||||
if [ "$WARN" = "1" ]; then
|
||||
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
|
||||
fi
|
||||
exit 0
|
6
roles/firmware/templates/fw_warn.sh
Normal file
6
roles/firmware/templates/fw_warn.sh
Normal file
|
@ -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
|
||||
|
|
@ -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")
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
if [ "$interface" = "br0" ] && [ $if_up = "true" ]; then
|
||||
syslog info "50-iiab IF_UP br0 restarting dnsmasq"
|
||||
sleep 2
|
||||
systemctl --no-block restart dnsmasq
|
||||
fi
|
||||
|
||||
if [ "$interface" = "wlan0" ]; then
|
||||
REASON="$reason"
|
||||
|
|
|
@ -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
|
||||
|
|
17
runrole
17
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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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).
|
||||
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue