istoreos/ota: supports ipv4 only network

Signed-off-by: Liangbin Lian <jjm2473@gmail.com>
This commit is contained in:
Liangbin Lian 2025-12-18 13:45:12 +08:00
parent f2e3777831
commit 7d2fec2d30
9 changed files with 37 additions and 4 deletions

View File

@ -4,10 +4,14 @@ include $(TOPDIR)/rules.mk
LUCI_TITLE:=LuCI for OTA upgrade
LUCI_DEPENDS:=+curl
LUCI_PKGARCH:=all
PKG_VERSION:=1.5.0
PKG_VERSION:=1.5.1
PKG_RELEASE:=1
PKG_MAINTAINER:=jjm2473 <jjm2473@gmail.com>
define Package/luci-app-ota/conffiles
/etc/config/ota
endef
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot signature

View File

@ -11,7 +11,9 @@ function index()
return
end
entry({"admin", "system", "ota"}, post_on({ apply = "1" }, "action_ota"), _("OTA"), 69)
entry({"admin", "system", "ota"}, alias("admin", "system", "ota", "index"), _("OTA"), 69)
entry({"admin", "system", "ota", "index"}, post_on({ apply = "1" }, "action_ota"), _("OTA"), 1)
entry({"admin", "system", "ota", "config"}, cbi("admin_system/ota_config"), _("Configuration"), 2)
entry({"admin", "system", "ota", "check"}, post("action_check"))
entry({"admin", "system", "ota", "download"}, post("action_download"))
entry({"admin", "system", "ota", "progress"}, call("action_progress"))

View File

@ -0,0 +1,10 @@
local m, s, o
m = Map("ota")
s=m:section(NamedSection, "network")
s.anonymous=true
o = s:option(Flag, "ipv4", translate("IPv4 only"), translate("Use IPv4 network for OTA operations"))
return m

View File

@ -26,7 +26,6 @@
</style>
<h2 name="content"><%:OTA%></h2>
<div class="cbi-section state-ctl state-ctl-unchecked">
<div class="cbi-section-descr"><%:Check and upgrade firmware from the Internet%></div>
<% if image_invalid then %>

View File

@ -60,3 +60,6 @@ msgstr ""
msgid "Found downloading firmware, will show progress"
msgstr ""
msgid "Use IPv4 network for OTA operations"
msgstr ""

View File

@ -60,3 +60,6 @@ msgstr ""
msgid "Found downloading firmware, will show progress"
msgstr ""
msgid "Use IPv4 network for OTA operations"
msgstr ""

View File

@ -60,3 +60,6 @@ msgstr "历史更新日志"
msgid "Found downloading firmware, will show progress"
msgstr "发现下载中的固件,将显示当前进度"
msgid "Use IPv4 network for OTA operations"
msgstr "使用 IPv4 连接 OTA 服务器"

View File

@ -35,7 +35,14 @@ sha256() {
sha256sum $1 | cut -d' ' -f1
}
alias fcurl='curl -L --fail --show-error'
OTA_CURL_OPTS=""
case $action in
"check"|"download")
[ "`uci -q get ota.network.ipv4`" = 1 ] && OTA_CURL_OPTS="--ipv4"
;;
esac
alias fcurl="curl $OTA_CURL_OPTS -L --fail --show-error"
unset OTA_CURL_OPTS
download() {
local img=$1

View File

@ -0,0 +1,2 @@
config global 'network'
# option ipv4 '0'