1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-13 19:52:06 +00:00
iiab/roles/firmware/templates/check-firmware.sh

48 lines
2.2 KiB
Bash
Raw Normal View History

2020-08-02 18:36:56 +00:00
#!/bin/bash
FW_MODE=$(grep wifi_hotspot_capacity_rpi_fix /etc/iiab/local_vars.yml| grep True)
WARN=0
2020-08-03 14:56:58 +00:00
DATE=$(date +%F-%T)
2020-08-02 18:36:56 +00:00
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
2020-08-03 14:56:58 +00:00
mv /lib/firmware/brcm/brcmfmac43455-sdio.bin /lib/firmware/brcm/brcmfmac43455-sdio.bin.$DATE
2020-08-02 18:36:56 +00:00
cp /lib/firmware/brcm/brcmfmac43455-sdio.bin.iiab /lib/firmware/brcm/brcmfmac43455-sdio.bin
2020-08-02 21:19:24 +00:00
echo "replacing firmware"
2020-08-02 18:36:56 +00:00
WARN=1
fi
2020-08-03 14:56:58 +00:00
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
2020-08-02 18:36:56 +00:00
if ! $(diff -q /lib/firmware/brcm/brcmfmac43430-sdio.bin.iiab /lib/firmware/brcm/brcmfmac43430-sdio.bin); then
2020-08-03 14:56:58 +00:00
mv /lib/firmware/brcm/brcmfmac43430-sdio.bin /lib/firmware/brcm/brcmfmac43430-sdio.bin.$DATE
2020-08-02 18:36:56 +00:00
cp /lib/firmware/brcm/brcmfmac43430-sdio.bin.iiab /lib/firmware/brcm/brcmfmac43430-sdio.bin
2020-08-03 09:06:17 +00:00
cp /lib/firmware/brcm/brcmfmac43430-sdio.clm_blob.iiab /lib/firmware/brcm/brcmfmac43430-sdio.clm_blob
2020-08-02 21:19:24 +00:00
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
2020-08-03 14:56:58 +00:00
mv /lib/firmware/brcm/brcmfmac43430-sdio.clm_blob /lib/firmware/brcm/brcmfmac43430-sdio.clm_blob.$DATE
2020-08-02 21:19:24 +00:00
cp /lib/firmware/brcm/brcmfmac43430-sdio.clm_blob.iiab /lib/firmware/brcm/brcmfmac43430-sdio.clm_blob
echo "replacing firmware"
2020-08-02 18:36:56 +00:00
WARN=1
fi
fi
2020-08-02 21:19:24 +00:00
if [ "$WARN" = "1" ]; then
2020-08-06 16:06:15 +00:00
echo -e " \033[31;5mFirmware has been replaced\033[0m"
echo -e " \033[31;5mReboot is required to activate\033[0m"
2020-08-02 18:36:56 +00:00
touch /.fw_replaced
2020-08-02 21:19:24 +00:00
#echo "rebooting..."
#reboot
2020-08-02 18:36:56 +00:00
else
2020-08-06 16:06:15 +00:00
echo -e " Firmware check \033[32;5mPASSED\033[0m"
2020-08-06 15:38:20 +00:00
if [ -f /.fw_replaced ]; then
rm /.fw_replaced
fi
2020-08-02 18:36:56 +00:00
fi
exit 0