diff --git a/applications/luci-app-xteve/Makefile b/applications/luci-app-xteve/Makefile index 0e67c5d..87bfa1b 100644 --- a/applications/luci-app-xteve/Makefile +++ b/applications/luci-app-xteve/Makefile @@ -2,12 +2,12 @@ include $(TOPDIR)/rules.mk -PKG_VERSION:=1.0.0-20221117 +PKG_VERSION:=1.0.0-20221212 PKG_RELEASE:= LUCI_TITLE:=LuCI support for Xteve LUCI_PKGARCH:=all -LUCI_DEPENDS:=+docker +luci-lib-taskd +LUCI_DEPENDS:=+docker +luci-lib-taskd +luci-lib-docker define Package/luci-app-xteve/conffiles /etc/config/xteve diff --git a/applications/luci-app-xteve/luasrc/model/cbi/xteve.lua b/applications/luci-app-xteve/luasrc/model/cbi/xteve.lua index 2aec035..ef58ffb 100644 --- a/applications/luci-app-xteve/luasrc/model/cbi/xteve.lua +++ b/applications/luci-app-xteve/luasrc/model/cbi/xteve.lua @@ -3,6 +3,7 @@ LuCI - Lua Configuration Interface ]]-- local taskd = require "luci.model.tasks" +local docker = require "luci.docker" local xteve_model = require "luci.model.xteve" local m, s, o @@ -11,6 +12,10 @@ m = taskd.docker_map("xteve", "xteve", "/usr/libexec/istorec/xteve.sh", translate("Xteve is M3U Proxy for Plex DVR and Emby Live TV.") .. translate("Official website:") .. ' https://github.com/xteve-project/xTeVe') +local dk = docker.new({socket_path="/var/run/docker.sock"}) +local dockerd_running = dk:_ping().code == 200 +local docker_info = dockerd_running and dk:info().body or {} + s = m:section(SimpleSection, translate("Service Status"), translate("Xteve status:")) s:append(Template("xteve/status")) @@ -26,8 +31,16 @@ o:depends("hostnet", 0) o = s:option(Value, "image_name", translate("Image").."*") o.rmempty = false o.datatype = "string" -o:value("alturismo/xteve_guide2go", "alturismo/xteve_guide2go") -o.default = "alturismo/xteve_guide2go" +if "x86_64" == docker_info.Architecture then + o:value("alturismo/xteve_guide2go", "alturismo/xteve_guide2go") + o.default = "alturismo/xteve_guide2go" +elseif "aarch64" == docker_info.Architecture then + o:value("coolyzp/xteve_guide2go:linux-arm64", "coolyzp/xteve_guide2go:linux-arm64") + o.default = "coolyzp/xteve_guide2go:linux-arm64" +else + o:value("", translate("Unsupported Architecture")) + o.default = "" +end local blocks = xteve_model.blocks() local home = xteve_model.home() diff --git a/applications/luci-app-xteve/po/zh-cn/xteve.po b/applications/luci-app-xteve/po/zh-cn/xteve.po index 9a5a50e..8d74470 100644 --- a/applications/luci-app-xteve/po/zh-cn/xteve.po +++ b/applications/luci-app-xteve/po/zh-cn/xteve.po @@ -39,3 +39,6 @@ msgstr "Xteve 未运行" msgid "Open Xteve" msgstr "打开 Xteve" + +msgid "Unsupported Architecture" +msgstr "不支持此架构" diff --git a/applications/luci-app-xteve/root/etc/config/xteve b/applications/luci-app-xteve/root/etc/config/xteve index 4695169..7c9628f 100644 --- a/applications/luci-app-xteve/root/etc/config/xteve +++ b/applications/luci-app-xteve/root/etc/config/xteve @@ -1,5 +1,4 @@ config main option 'port' '34400' - option 'image_name' 'alturismo/xteve_guide2go' option 'config_path' '' diff --git a/applications/luci-app-xteve/root/etc/uci-defaults/luci-app-xteve b/applications/luci-app-xteve/root/etc/uci-defaults/luci-app-xteve new file mode 100644 index 0000000..b2240fc --- /dev/null +++ b/applications/luci-app-xteve/root/etc/uci-defaults/luci-app-xteve @@ -0,0 +1,11 @@ +#!/bin/sh + +image_name=`uci get xteve.@main[0].image_name 2>/dev/null` + +if [ "$image_name" == "alturismo/xteve_guide2go" -a "`uname -m`" != "x86_64" ]; then + uci -q batch <<-EOF >/dev/null + set xteve.@main[0].image_name="" + commit xteve +EOF +fi +exit 0 diff --git a/applications/luci-app-xteve/root/usr/libexec/istorec/xteve.sh b/applications/luci-app-xteve/root/usr/libexec/istorec/xteve.sh index f01dd93..2242f7e 100755 --- a/applications/luci-app-xteve/root/usr/libexec/istorec/xteve.sh +++ b/applications/luci-app-xteve/root/usr/libexec/istorec/xteve.sh @@ -10,33 +10,31 @@ do_install() { local config=`uci get xteve.@main[0].config_path 2>/dev/null` local tz=`uci get xteve.@main[0].time_zone 2>/dev/null` - [ -z "$image_name" ] && image_name="alturismo/xteve_guide2go" - echo "docker pull ${image_name}" - docker pull ${image_name} - docker rm -f xteve - if [ -z "$config" ]; then echo "config path is empty!" exit 1 fi - - local unameinfo=`uname -m` - if echo "$unameinfo" | grep -Eqi 'x86_64'; then - echo "x86_64 supported" - else - echo "$unameinfo not supported, only x86_64 supported" - exit 1 + if [ -z "$image_name" ]; then + local arch=`uname -m` + [ "$arch" = "x86_64" ] && image_name="alturismo/xteve_guide2go" + [ "$arch" = "aarch64" ] && image_name="coolyzp/xteve_guide2go:linux-arm64" + if [ -z "$image_name" ]; then + echo "$arch is unsupported!" >&2 + exit 1 + fi fi + echo "docker pull ${image_name}" + docker pull ${image_name} + docker rm -f xteve + [ -z "$port" ] && port=34400 local cmd="docker run --restart=unless-stopped -d \ - --log-opt max-size=10m \ - --log-opt max-file=3 \ - -v $config/Xteve/:/root/.xteve:rw \ - -v $config/Xteve/_config/:/config:rw \ - -v $config/Xteve/_guide2go/:/guide2go:rw \ - -v /tmp/xteve/:/tmp/xteve:rw \ + -v $config:/root/.xteve:rw \ + -v $config/_config:/config:rw \ + -v $config/_guide2go:/guide2go:rw \ + -v /tmp/xteve:/tmp/xteve:rw \ -p $port:34400 " if [ -z "$tz" ]; then