luci-app-xteve: diff image for diff arch
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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:") .. ' <a href=\"https://github.com/xteve-project/xTeVe\" target=\"_blank\">https://github.com/xteve-project/xTeVe</a>')
|
||||
|
||||
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").."<b>*</b>")
|
||||
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()
|
||||
|
||||
@@ -39,3 +39,6 @@ msgstr "Xteve 未运行"
|
||||
|
||||
msgid "Open Xteve"
|
||||
msgstr "打开 Xteve"
|
||||
|
||||
msgid "Unsupported Architecture"
|
||||
msgstr "不支持此架构"
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
config main
|
||||
option 'port' '34400'
|
||||
option 'image_name' 'alturismo/xteve_guide2go'
|
||||
option 'config_path' ''
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user