Skip to content

Commit

Permalink
update webvirtcloud (#438)
Browse files Browse the repository at this point in the history
Co-authored-by: janson <[email protected]>
  • Loading branch information
jannson and mjanson authored Dec 21, 2024
1 parent ea56cad commit 34dd3d4
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 2 deletions.
2 changes: 1 addition & 1 deletion applications/app-meta-ubuntu/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ PKG_VERSION:=1.0.10
PKG_RELEASE:=20241216
META_TITLE:=Ubuntu
META_DEPENDS:=+luci-app-ubuntu2 +luci-i18n-ubuntu2-zh-cn +docker-deps
META_DESCRIPTION:=带Web远程桌面的Docker版Ubuntu,纯英文系统,欢迎各位极客玩家享用。
META_DESCRIPTION:=带Web远程桌面的高性能Docker版Ubuntu。
META_DESCRIPTION.en=Ubuntu2 is a high-Performance ubuntu with web remote desktop.
META_AUTHOR:=xiaobao
META_TAGS:=system tool
Expand Down
4 changes: 3 additions & 1 deletion applications/app-meta-webvirtcloud/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

include $(TOPDIR)/rules.mk

PKG_VERSION:=0.3.9
PKG_VERSION:=0.8.5
PKG_RELEASE:=1
META_TITLE:=KVM虚拟机(WebVirtCloud)
META_DEPENDS:=+vmease +luci-app-webvirtcloud +luci-i18n-webvirtcloud-zh-cn +docker-deps
Expand All @@ -13,6 +13,8 @@ META_TAGS:=system tool
META_ARCH:=x86_64
META_LUCI_ENTRY:=/cgi-bin/luci/admin/services/webvirtcloud
META_WEBSITE:=https://webvirt.cloud/
META_AUTOCONF:=path enable
META_UCI:=webvirtcloud

include ../../meta.mk

Expand Down
12 changes: 12 additions & 0 deletions applications/app-meta-webvirtcloud/config.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

[ -z "$ISTORE_CONF_DIR" ] && exit 1

uci -q batch <<-EOF >/dev/null || exit 1
set webvirtcloud.@webvirtcloud[0].config_path="$ISTORE_CONF_DIR/WebVirtCloud"
commit webvirtcloud
EOF

ISTORE_ACTION=install
[ -z "$ISTORE_DONT_START" ] || ISTORE_ACTION=stop

/usr/libexec/istorec/webvirtcloud.sh $ISTORE_ACTION
57 changes: 57 additions & 0 deletions applications/app-meta-webvirtcloud/entry.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/bin/sh

ISTOREC_SCRIPT=/usr/libexec/istorec/webvirtcloud.sh

status(){
local host="$1"
[ -n "$host" ] || host=127.0.0.1
. /usr/share/libubox/jshn.sh
json_init
json_add_string "app" "webvirtcloud"
json_add_boolean "docker" "1"

local status=`$ISTOREC_SCRIPT status 2>/dev/null`
if [ "$status" = "running" ]; then
json_add_boolean "running" "1"
local port=`$ISTOREC_SCRIPT port`
local portsec=${port:-6009}
json_add_string "web" ":${portsec}"
json_add_string "href" "http://$host:${portsec}/"
json_add_string "protocol" http
json_add_string "port" ${portsec}
else
json_add_boolean "running" "0"
if [ -z "$status" ]; then
json_add_boolean "deployed" "0"
else
json_add_boolean "deployed" "1"
fi
fi

json_dump
json_cleanup >/dev/null
}

start(){
# [ -z "`$ISTOREC_SCRIPT status`" ] && $ISTOREC_SCRIPT install && sleep 5
[ -z "`$ISTOREC_SCRIPT status`" ] && return 1
[ "`$ISTOREC_SCRIPT status`" = "running"] || $ISTOREC_SCRIPT start
}

stop(){
[ "`$ISTOREC_SCRIPT status`" != "running"] || $ISTOREC_SCRIPT stop
}

ACTION=${1}
shift 1
[ -z "${ACTION}" ] && ACTION=help

case ${ACTION} in
"status" | "start" | "stop")
${ACTION} "$@"
;;
*)
echo "Unknown Action" >&2
exit 1
;;
esac

0 comments on commit 34dd3d4

Please sign in to comment.