Auto reinstall package improvements (#932)

* Add network detection and retry

* Add message when package reinstall is happening

* Update permenant package list
This commit is contained in:
Tim Wilkinson 2023-09-16 18:09:18 -07:00 committed by GitHub
parent cf84853530
commit 91ab73fe6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 128 additions and 39 deletions

View File

@ -41,6 +41,17 @@ local package_store = "/etc/package_store"
local package_catalog = package_store .. "/catalog.json" local package_catalog = package_store .. "/catalog.json"
if nixio.fs.stat(package_catalog) then if nixio.fs.stat(package_catalog) then
-- Make sure we can contact the package server before proceeding.
-- We'll wait a few minutes before going ahead anyway
for i = 1,5
do
if os.execute("ping -q -c 1 -W 5 downloads.arednmesh.org > /dev/null 2>&1") == 0 then
break
end
print("Failed to contact package server - retry in 60 seconds")
nixio.nanosleep(60, 0)
end
os.execute("opkg update") os.execute("opkg update")
local catalog = luci.jsonc.parse(io.open(package_catalog):read("*a")) local catalog = luci.jsonc.parse(io.open(package_catalog):read("*a"))
for ipkg, state in pairs(catalog.installed) for ipkg, state in pairs(catalog.installed)
@ -56,4 +67,5 @@ if nixio.fs.stat(package_catalog) then
end end
end end
-- Don't do this again
os.remove("/etc/cron.boot/reinstall-packages") os.remove("/etc/cron.boot/reinstall-packages")

View File

@ -1,79 +1,142 @@
ath10k-board-qca9887
ath10k-board-qca988x
ath10k-firmware-qca4019-ct
ath10k-firmware-qca9887-ct
ath10k-firmware-qca988x-ct
base-files base-files
bridge
busybox busybox
ca-bundle
curl
dnsmasq dnsmasq
dropbear dropbear
firewall ethtool
hotplug2 firewall4
ip fstools
fwtool
getrandom
hostapd-common
iperf3 iperf3
nftables
iw iw
iwinfo iwinfo
jansson4
jshn jshn
jsonfilter
kernel kernel
kmod-ath kmod-ath
kmod-ath10k-ct
kmod-ath10k-ct-smallbuffers
kmod-ath9k kmod-ath9k
kmod-ath9k-common kmod-ath9k-common
kmod-cfg80211 kmod-cfg80211
kmod-crypto-aes kmod-crypto-aead
kmod-crypto-arc4 kmod-crypto-ccm
kmod-crypto-core kmod-crypto-cmac
kmod-crypto-crc32c
kmod-crypto-ctr
kmod-crypto-gcm
kmod-crypto-gf128
kmod-crypto-ghash
kmod-crypto-hash
kmod-crypto-hmac
kmod-crypto-manager
kmod-crypto-null
kmod-crypto-rng
kmod-crypto-seqiv
kmod-crypto-sha256
kmod-gpio-button-hotplug kmod-gpio-button-hotplug
kmod-ipt-conntrack kmod-hwmon-core
kmod-ipt-core kmod-ipip
kmod-ipt-ipopt kmod-iptunnel
kmod-ipt-nat kmod-iptunnel4
kmod-ipt-nathelper
kmod-leds-gpio kmod-leds-gpio
kmod-ledtrig-default-on kmod-ledtrig-gpio
kmod-ledtrig-netdev kmod-lib-crc32c
kmod-ledtrig-timer
kmod-ledtrig-usbdev
kmod-lib-crc-ccitt
kmod-mac80211 kmod-mac80211
kmod-nf-conntrack
kmod-nf-flow
kmod-nf-log
kmod-nf-nat
kmod-nf-reject
kmod-nfnetlink
kmod-nft-core
kmod-nft-fib
kmod-nft-nat
kmod-nft-offload
kmod-nls-base kmod-nls-base
kmod-tun kmod-tun
kmod-usb-core kmod-usb-core
kmod-usb-ohci kmod-usb-dwc3
kmod-usb-uhci kmod-usb-dwc3-qcom
kmod-usb2 libblobmsg-json20220515
kmod-wdt-ath79
libblobmsg-json
libc libc
libgcc libcurl4
libip4tc libgcc1
libiwinfo libiwinfo-data
libjson libiwinfo-lua
liblzo libiwinfo20210430
libnl-tiny libjson-c5
libpcap libjson-script20220515
liblua5.1.5
liblucihttp-lua
liblucihttp0
liblzo2
libmbedtls12
libmnl0
libnftnl11
libnl-tiny1
libpthread libpthread
librt librt
libubox libubox20220515
libubus libubus-lua
libuci libubus20220601
libxtables libuci-lua
libuci20130104
libuclient20201210
libucode20220812
libxtables12
logd
lua
luasocket
luci-lib-base
luci-lib-ip
luci-lib-jsonc
luci-lib-nixio
mtd mtd
netifd netifd
nftables-json
olsrd olsrd
olsrd-mod-arprefresh olsrd-mod-arprefresh
olsrd-mod-dot-draw olsrd-mod-dot-draw
olsrd-mod-dyn-gw olsrd-mod-dyn-gw
olsrd-mod-httpinfo olsrd-mod-jsoninfo
olsrd-mod-nameservice olsrd-mod-nameservice
olsrd-mod-secure
olsrd-mod-txtinfo olsrd-mod-txtinfo
olsrd-mod-watchdog olsrd-mod-watchdog
openwrt-keyring
opkg opkg
ssidident procd
prometheus-exporter
rpcd
rpcd-mod-file
rpcd-mod-luci
rssileds
swconfig swconfig
tcpdump-mini ubi-utils
uboot-envtools uboot-envtools
ubox
ubus ubus
ubusd ubusd
uci uci
uclient-fetch
ucode
ucode-mod-fs
ucode-mod-ubus
ucode-mod-uci
uhttpd uhttpd
urandom-seed
urngd
usign
vtun vtun
wireless-regdb
wpad-mini wpad-mini
zlib zlib

View File

@ -72,6 +72,15 @@ function html.alert_banner()
if not aredn.hardware.supported() then if not aredn.hardware.supported() then
html.print("<center><div style=\"padding:5px;background-color:#FF4719;color:black;border:1px solid #ccc;width:600px;\"><a href=\"/cgi-bin/sysinfo\">!!!! UNSUPPORTED DEVICE !!!!</a></div></center>") html.print("<center><div style=\"padding:5px;background-color:#FF4719;color:black;border:1px solid #ccc;width:600px;\"><a href=\"/cgi-bin/sysinfo\">!!!! UNSUPPORTED DEVICE !!!!</a></div></center>")
end end
local f = io.open("/etc/cron.boot/reinstall-packages")
if f then
f:close()
f = io.open("/etc/package_store/catalog.json")
if f then
f:close()
html.print("<center><div style=\"padding:5px;color:black;border:1px solid #ccc;width:650px;\">Packages are being reinstalled in the background. This can take a few minutes.</div></center>")
end
end
html.print("</div>") html.print("</div>")
end end

View File

@ -613,7 +613,12 @@ function record_package(op, ipkg, file)
nixio.fs.remove(package_store .. "/" .. ipkg .. ".ipk") nixio.fs.remove(package_store .. "/" .. ipkg .. ".ipk")
catalog.installed[ipkg] = nil catalog.installed[ipkg] = nil
end end
os.remove(package_catalog)
for _,_ in pairs(catalog.installed)
do
write_all(package_catalog, luci.jsonc.stringify(catalog)) write_all(package_catalog, luci.jsonc.stringify(catalog))
break
end
end end
-- upload package -- upload package