diff --git a/package/lean/luci-app-xlnetacc/Makefile b/package/lean/luci-app-xlnetacc/Makefile index 317c30014..b834a1bd5 100644 --- a/package/lean/luci-app-xlnetacc/Makefile +++ b/package/lean/luci-app-xlnetacc/Makefile @@ -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 +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 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))) diff --git a/package/lean/luci-app-xlnetacc/luasrc/controller/xlnetacc.lua b/package/lean/luci-app-xlnetacc/luasrc/controller/xlnetacc.lua index ab9d92947..cf043a64c 100644 --- a/package/lean/luci-app-xlnetacc/luasrc/controller/xlnetacc.lua +++ b/package/lean/luci-app-xlnetacc/luasrc/controller/xlnetacc.lua @@ -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 "" }) diff --git a/package/lean/luci-app-xlnetacc/luasrc/model/cbi/xlnetacc.lua b/package/lean/luci-app-xlnetacc/luasrc/model/cbi/xlnetacc.lua index bdab81929..13d0ef6f5 100644 --- a/package/lean/luci-app-xlnetacc/luasrc/model/cbi/xlnetacc.lua +++ b/package/lean/luci-app-xlnetacc/luasrc/model/cbi/xlnetacc.lua @@ -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 diff --git a/package/lean/luci-app-xlnetacc/luasrc/view/xlnetacc/status.htm b/package/lean/luci-app-xlnetacc/luasrc/view/xlnetacc/xlnetacc_status.htm similarity index 100% rename from package/lean/luci-app-xlnetacc/luasrc/view/xlnetacc/status.htm rename to package/lean/luci-app-xlnetacc/luasrc/view/xlnetacc/xlnetacc_status.htm diff --git a/package/lean/luci-app-xlnetacc/root/etc/init.d/xlnetacc b/package/lean/luci-app-xlnetacc/root/etc/init.d/xlnetacc index 6ad2adbfe..160fa0c59 100755 --- a/package/lean/luci-app-xlnetacc/root/etc/init.d/xlnetacc +++ b/package/lean/luci-app-xlnetacc/root/etc/init.d/xlnetacc @@ -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 diff --git a/package/lean/luci-app-xlnetacc/root/usr/bin/xlnetacc.sh b/package/lean/luci-app-xlnetacc/root/usr/bin/xlnetacc similarity index 100% rename from package/lean/luci-app-xlnetacc/root/usr/bin/xlnetacc.sh rename to package/lean/luci-app-xlnetacc/root/usr/bin/xlnetacc