From 121548b1539df06e38a04c67884f54313faf00cf Mon Sep 17 00:00:00 2001 From: lean Date: Mon, 18 Jan 2021 12:53:23 +0800 Subject: [PATCH] Add luci-app-uugamebooster for uuplugin --- package/lean/luci-app-uugamebooster/Makefile | 17 ++++++++++++++ .../luasrc/controller/uuplugin.lua | 15 ++++++++++++ .../luasrc/model/cbi/uuplugin/uuplugin.lua | 15 ++++++++++++ .../luasrc/view/uuplugin/uuplugin_status.htm | 21 +++++++++++++++++ .../po/zh-cn/uuplugin.po | 12 ++++++++++ .../root/etc/config/uuplugin | 4 ++++ .../root/etc/init.d/uuplugin | 23 +++++++++++++++++++ .../root/etc/uci-defaults/45_luci-uuplugin | 11 +++++++++ package/lean/uugamebooster/Makefile | 6 ++--- .../uugamebooster/files/uugamebooster.init | 18 --------------- 10 files changed, 121 insertions(+), 21 deletions(-) create mode 100644 package/lean/luci-app-uugamebooster/Makefile create mode 100644 package/lean/luci-app-uugamebooster/luasrc/controller/uuplugin.lua create mode 100644 package/lean/luci-app-uugamebooster/luasrc/model/cbi/uuplugin/uuplugin.lua create mode 100644 package/lean/luci-app-uugamebooster/luasrc/view/uuplugin/uuplugin_status.htm create mode 100644 package/lean/luci-app-uugamebooster/po/zh-cn/uuplugin.po create mode 100644 package/lean/luci-app-uugamebooster/root/etc/config/uuplugin create mode 100755 package/lean/luci-app-uugamebooster/root/etc/init.d/uuplugin create mode 100644 package/lean/luci-app-uugamebooster/root/etc/uci-defaults/45_luci-uuplugin delete mode 100755 package/lean/uugamebooster/files/uugamebooster.init diff --git a/package/lean/luci-app-uugamebooster/Makefile b/package/lean/luci-app-uugamebooster/Makefile new file mode 100644 index 000000000..9c9342446 --- /dev/null +++ b/package/lean/luci-app-uugamebooster/Makefile @@ -0,0 +1,17 @@ +# Copyright (C) 2020 Openwrt.org +# +# This is free software, licensed under the Apache License, Version 2.0 . +# + +include $(TOPDIR)/rules.mk + +LUCI_TITLE:=LuCI support for UUgamebooster +LUCI_DEPENDS:=+uugamebooster +LUCI_PKGARCH:=all +PKG_NAME:=luci-app-uugamebooster +PKG_VERSION:=1.0 +PKG_RELEASE:=3 + +include $(TOPDIR)/feeds/luci/luci.mk + +# call BuildPackage - OpenWrt buildroot signature \ No newline at end of file diff --git a/package/lean/luci-app-uugamebooster/luasrc/controller/uuplugin.lua b/package/lean/luci-app-uugamebooster/luasrc/controller/uuplugin.lua new file mode 100644 index 000000000..f67e4cb7e --- /dev/null +++ b/package/lean/luci-app-uugamebooster/luasrc/controller/uuplugin.lua @@ -0,0 +1,15 @@ +module("luci.controller.uuplugin",package.seeall) + +function index() + if not nixio.fs.access("/etc/config/uuplugin") then return end + + entry({"admin", "services", "uuplugin"}, cbi("uuplugin/uuplugin"), ("UU GameAcc"),99).dependent=true + entry({"admin","services","uuplugin","status"},call("act_status")).leaf=true +end + +function act_status() + local e={} + e.running=luci.sys.call("pgrep -f uuplugin >/dev/null")==0 + luci.http.prepare_content("application/json") + luci.http.write_json(e) +end diff --git a/package/lean/luci-app-uugamebooster/luasrc/model/cbi/uuplugin/uuplugin.lua b/package/lean/luci-app-uugamebooster/luasrc/model/cbi/uuplugin/uuplugin.lua new file mode 100644 index 000000000..071afda67 --- /dev/null +++ b/package/lean/luci-app-uugamebooster/luasrc/model/cbi/uuplugin/uuplugin.lua @@ -0,0 +1,15 @@ +require("luci.util") + +mp = Map("uuplugin", translate("UU Game Accelerator")) +mp.description = translate("A Paid Game Acceleration service") +mp:section(SimpleSection).template = "uuplugin/uuplugin_status" + +s = mp:section(TypedSection, "uuplugin") +s.anonymous=true +s.addremove=false + +o = s:option(Flag, "enabled", translate("Enable")) +o.default = 0 +o.optional = false + +return mp diff --git a/package/lean/luci-app-uugamebooster/luasrc/view/uuplugin/uuplugin_status.htm b/package/lean/luci-app-uugamebooster/luasrc/view/uuplugin/uuplugin_status.htm new file mode 100644 index 000000000..c4930636e --- /dev/null +++ b/package/lean/luci-app-uugamebooster/luasrc/view/uuplugin/uuplugin_status.htm @@ -0,0 +1,21 @@ + + +
+

+ <%:Collecting data...%> +

+
diff --git a/package/lean/luci-app-uugamebooster/po/zh-cn/uuplugin.po b/package/lean/luci-app-uugamebooster/po/zh-cn/uuplugin.po new file mode 100644 index 000000000..855cf3461 --- /dev/null +++ b/package/lean/luci-app-uugamebooster/po/zh-cn/uuplugin.po @@ -0,0 +1,12 @@ + +msgid "Enable" +msgstr "启用" + +msgid "UU GameAcc" +msgstr "UU游戏加速器" + +msgid "UU Game Accelerator" +msgstr "UU游戏加速器" + +msgid "A Paid Game Acceleration service" +msgstr "一个富家子弟用的的游戏加速器" diff --git a/package/lean/luci-app-uugamebooster/root/etc/config/uuplugin b/package/lean/luci-app-uugamebooster/root/etc/config/uuplugin new file mode 100644 index 000000000..3df312749 --- /dev/null +++ b/package/lean/luci-app-uugamebooster/root/etc/config/uuplugin @@ -0,0 +1,4 @@ + +config uuplugin 'uuplugin' + option enabled '0' + diff --git a/package/lean/luci-app-uugamebooster/root/etc/init.d/uuplugin b/package/lean/luci-app-uugamebooster/root/etc/init.d/uuplugin new file mode 100755 index 000000000..6eec9607d --- /dev/null +++ b/package/lean/luci-app-uugamebooster/root/etc/init.d/uuplugin @@ -0,0 +1,23 @@ +#!/bin/sh /etc/rc.common + +START=99 +STOP=10 + +USE_PROCD=1 + +NAME="uugamebooster" +UU_BIN="/usr/share/uugamebooster/uuplugin" +UU_CONF="/usr/share/uugamebooster/uu.conf" +UU_LOGFILE="/tmp/uugamebooster.log" + +start_service() { + config_load uuplugin + local enable + config_get_bool enable uuplugin enabled + if [ "$enable" -eq 1 ]; then + procd_open_instance + procd_set_param command $UU_BIN $UU_CONF >$UU_LOGFILE 2>&1 + procd_set_param respawn + procd_close_instance + fi +} diff --git a/package/lean/luci-app-uugamebooster/root/etc/uci-defaults/45_luci-uuplugin b/package/lean/luci-app-uugamebooster/root/etc/uci-defaults/45_luci-uuplugin new file mode 100644 index 000000000..e65f87ece --- /dev/null +++ b/package/lean/luci-app-uugamebooster/root/etc/uci-defaults/45_luci-uuplugin @@ -0,0 +1,11 @@ +#!/bin/sh + +uci -q batch <<-EOF >/dev/null + delete ucitrack.@uuplugin[-1] + add ucitrack uuplugin + set ucitrack.@uuplugin[-1].init=uuplugin + commit ucitrack +EOF + +rm -f /tmp/luci-indexcache +exit 0 diff --git a/package/lean/uugamebooster/Makefile b/package/lean/uugamebooster/Makefile index c73446554..10a075b0b 100644 --- a/package/lean/uugamebooster/Makefile +++ b/package/lean/uugamebooster/Makefile @@ -13,7 +13,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=uugamebooster PKG_VERSION:=v2.7.2 -PKG_RELEASE:=2 +PKG_RELEASE:=5 include $(INCLUDE_DIR)/package.mk @@ -70,8 +70,8 @@ define Build/Compile endef define Package/$(PKG_NAME)/install - $(INSTALL_DIR) $(1)/etc/init.d - $(INSTALL_BIN) ./files/uugamebooster.init $(1)/etc/init.d/uugamebooster + # $(INSTALL_DIR) $(1)/etc/init.d + # $(INSTALL_BIN) ./files/uugamebooster.init $(1)/etc/init.d/uuplugin $(INSTALL_DIR) $(1)/usr/share/$(PKG_NAME) $(INSTALL_BIN) $(UNTAR_DIR)/uuplugin $(1)/usr/share/$(PKG_NAME)/uuplugin diff --git a/package/lean/uugamebooster/files/uugamebooster.init b/package/lean/uugamebooster/files/uugamebooster.init deleted file mode 100755 index 7fa2ea8ac..000000000 --- a/package/lean/uugamebooster/files/uugamebooster.init +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh /etc/rc.common - -START=99 -STOP=10 - -USE_PROCD=1 - -NAME="uugamebooster" -UU_BIN="/usr/share/uugamebooster/uuplugin" -UU_CONF="/usr/share/uugamebooster/uu.conf" -UU_LOGFILE="/tmp/uugamebooster.log" - -start_service() { - procd_open_instance - procd_set_param command $UU_BIN $UU_CONF >$UU_LOGFILE 2>&1 - procd_set_param respawn - procd_close_instance -}