mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-04-18 17:33:31 +00:00
luci-app-xlnetacc: tidy up Makefile (#6637)
This commit is contained in:
parent
28a4d0ce78
commit
570300eca7
@ -2,10 +2,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-xlnetacc
|
||||
PKG_VERSION:=1.0.5
|
||||
PKG_RELEASE:=2
|
||||
|
||||
PKG_LICENSE:=GPLv2
|
||||
PKG_MAINTAINER:=Sense <sensec@gmail.com>
|
||||
PKG_RELEASE:=4
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
@ -16,18 +13,25 @@ define Package/$(PKG_NAME)
|
||||
TITLE:=LuCI Support for XLNetAcc
|
||||
PKGARCH:=all
|
||||
DEPENDS:=+jshn +wget +openssl-util
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/description
|
||||
LuCI Support for XLNetAcc.
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
MAINTAINER:=Sense <sensec@gmail.com>
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/conffiles
|
||||
/etc/config/xlnetacc
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/lua/luci
|
||||
cp -pR ./luasrc/* $(1)/usr/lib/lua/luci
|
||||
$(INSTALL_DIR) $(1)/
|
||||
cp -pR ./root/* $(1)/
|
||||
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/i18n
|
||||
po2lmo ./po/zh-cn/xlnetacc.po $(1)/usr/lib/lua/luci/i18n/xlnetacc.zh-cn.lmo
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/postinst
|
||||
#!/bin/sh
|
||||
if [ -z "$${IPKG_INSTROOT}" ]; then
|
||||
@ -36,29 +40,4 @@ fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/conffiles
|
||||
/etc/config/xlnetacc
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/controller
|
||||
$(INSTALL_DATA) ./luasrc/controller/*.lua $(1)/usr/lib/lua/luci/controller/
|
||||
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/model/cbi
|
||||
$(INSTALL_DATA) ./luasrc/model/cbi/*.lua $(1)/usr/lib/lua/luci/model/cbi/
|
||||
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/view/xlnetacc
|
||||
$(INSTALL_DATA) ./luasrc/view/xlnetacc/*.htm $(1)/usr/lib/lua/luci/view/xlnetacc/
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_CONF) ./root/etc/config/xlnetacc $(1)/etc/config/xlnetacc
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./root/etc/init.d/xlnetacc $(1)/etc/init.d/xlnetacc
|
||||
$(INSTALL_DIR) $(1)/etc/hotplug.d/iface
|
||||
$(INSTALL_BIN) ./root/etc/hotplug.d/iface/95-xlnetacc $(1)/etc/hotplug.d/iface/95-xlnetacc
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_BIN) ./root/etc/uci-defaults/luci-xlnetacc $(1)/etc/uci-defaults/luci-xlnetacc
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) ./root/usr/bin/xlnetacc.sh $(1)/usr/bin/xlnetacc.sh
|
||||
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/i18n
|
||||
po2lmo ./po/zh-cn/xlnetacc.po $(1)/usr/lib/lua/luci/i18n/xlnetacc.zh-cn.lmo
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
||||
|
@ -18,14 +18,10 @@ function index()
|
||||
entry({"admin", "services", "xlnetacc", "logdata"}, call("action_log"))
|
||||
end
|
||||
|
||||
local function is_running()
|
||||
return luci.sys.call("(ps | grep xlnetacc.sh | grep -v 'grep') >/dev/null" ) == 0
|
||||
end
|
||||
|
||||
function action_status()
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json({
|
||||
run_state = is_running(),
|
||||
run_state = luci.sys.call("(ps | grep xlnetacc | grep -v 'grep') >/dev/null" ) == 0,
|
||||
down_state = nixio.fs.readfile("/var/state/xlnetacc_down_state") or "",
|
||||
up_state = nixio.fs.readfile("/var/state/xlnetacc_up_state") or ""
|
||||
})
|
||||
|
@ -2,7 +2,7 @@ local m, s, o
|
||||
local uci = luci.model.uci.cursor()
|
||||
|
||||
m = Map("xlnetacc", "%s - %s" %{translate("XLNetAcc"), translate("Settings")}, translate("XLNetAcc is a Thunder joint broadband operators launched a commitment to help users solve the low broadband, slow Internet access, poor Internet experience of professional-grade broadband upgrade software."))
|
||||
m:append(Template("xlnetacc/status"))
|
||||
m:append(Template("xlnetacc/xlnetacc_status"))
|
||||
|
||||
s = m:section(NamedSection, "general", "general", translate("General Settings"))
|
||||
s.anonymous = true
|
||||
|
@ -8,7 +8,7 @@ NAME=xlnetacc
|
||||
|
||||
start() {
|
||||
local retry=1
|
||||
while pidof "${NAME}.sh" >/dev/null 2>&1; do
|
||||
while pidof "${NAME}" >/dev/null 2>&1; do
|
||||
[ $retry -ge 10 ] && return 1 || let retry++
|
||||
sleep 1
|
||||
done
|
||||
@ -23,14 +23,14 @@ start() {
|
||||
( [ $enabled -eq 0 ] || [ $down_acc -eq 0 -a $up_acc -eq 0 ] || [ -z "$username" -o -z "$password" -o -z "$network" ] ) && return 2
|
||||
|
||||
logger -p "daemon.notice" -t "$NAME" "XLNetAcc is starting ..."
|
||||
service_start /usr/bin/${NAME}.sh --start
|
||||
service_start /usr/bin/${NAME} --start
|
||||
}
|
||||
|
||||
stop() {
|
||||
ps | grep xlnetacc.sh | grep -v 'grep' >/dev/null 2>&1 || return 1
|
||||
ps | grep xlnetacc | grep -v 'grep' >/dev/null 2>&1 || return 1
|
||||
|
||||
local pid spid
|
||||
for pid in $(ps | grep xlnetacc.sh | grep -v 'grep' | awk '{print $1}'); do
|
||||
for pid in $(ps | grep xlnetacc | grep -v 'grep' | awk '{print $1}'); do
|
||||
echo "Stop XLNetAcc process PID: $pid"
|
||||
kill $pid >/dev/null 2>&1
|
||||
for spid in $(pgrep -P $pid "sleep"); do
|
||||
|
Loading…
Reference in New Issue
Block a user