From 5b0196da80c27cdd718d4afdaa97b6b06bf1a173 Mon Sep 17 00:00:00 2001 From: AmadeusGhost <42570690+AmadeusGhost@users.noreply.github.com> Date: Tue, 21 Apr 2020 12:01:39 +0800 Subject: [PATCH] scutclient: update to 3.1.2 --- package/ntlf9t/luci-app-scutclient/Makefile | 6 +++- .../luasrc/view/scutclient/status.htm | 29 ++++++++++--------- package/ntlf9t/scutclient/Makefile | 24 +++++++-------- .../ntlf9t/scutclient/files/scutclient.config | 4 +-- .../scutclient/files/scutclient.hotplug | 2 +- .../ntlf9t/scutclient/files/scutclient.init | 8 +++-- 6 files changed, 37 insertions(+), 36 deletions(-) diff --git a/package/ntlf9t/luci-app-scutclient/Makefile b/package/ntlf9t/luci-app-scutclient/Makefile index ede58076b7..9883075f38 100644 --- a/package/ntlf9t/luci-app-scutclient/Makefile +++ b/package/ntlf9t/luci-app-scutclient/Makefile @@ -1,5 +1,5 @@ # -# Copyright (C) 2008-2014 The LuCI Team +# Copyright (C) 2016 SCUT Router Term # # This is free software, licensed under the Apache License, Version 2.0 . # @@ -8,5 +8,9 @@ include $(TOPDIR)/rules.mk LUCI_TITLE:=LuCI Support for scutclient LUCI_DEPENDS:=+scutclient PKG_VERSION:=1.2 +PKG_RELEASE:=2 +PKG_LICENSE:=Apache-2.0 + include $(TOPDIR)/feeds/luci/luci.mk + # call BuildPackage - OpenWrt buildroot signature diff --git a/package/ntlf9t/luci-app-scutclient/luasrc/view/scutclient/status.htm b/package/ntlf9t/luci-app-scutclient/luasrc/view/scutclient/status.htm index bf02368632..492625986e 100644 --- a/package/ntlf9t/luci-app-scutclient/luasrc/view/scutclient/status.htm +++ b/package/ntlf9t/luci-app-scutclient/luasrc/view/scutclient/status.htm @@ -5,10 +5,8 @@ local sys = require "luci.sys" local fs = require "nixio.fs" local uci = require "luci.model.uci".cursor() -local ipkg = require "luci.model.ipkg" local ntm = require "luci.model.network".init() -local wan = ntm:get_wannet() -local wandev = ntm:get_wandev() +local scutclient_version = luci.sys.exec("opkg list-installed scutclient | cut -d ' ' -f 3") local scutclient_status = {} scutclient_status.enable = uci:get_first("scutclient", "option", "enable") scutclient_status.username = uci:get_first("scutclient", "scutclient", "username") @@ -23,17 +21,20 @@ mode_links.redial = mode_links.base.."?redial=1" mode_links.logoff = mode_links.base.."?logoff=1" mode_links.move_tag = mode_links.base .."?move_tag=1" -function page_moved() - return (uci:get_first("scutclient", "luci", "mainorder", 10) == 10) +local stat, wan_nets = pcall(ntm.get_wan_networks, ntm) +local wan, wandev +if stat then + if #wan_nets > 0 then + wan = wan_nets[1] + wandev = wan:get_interface() + end +else + wan = ntm:get_wannet() + wandev = ntm:get_wandev() end -function get_client_version(pkg_name) - local clistat = ipkg.info('scutclient') - if clistat['scutclient'] then - return clistat['scutclient']['Version'] - else - return nil - end +function page_moved() + return (uci:get_first("scutclient", "luci", "mainorder", 10) == 10) end function get_client_status(exec_name) @@ -150,9 +151,9 @@ end - <% if get_client_version("scutclient") then %> + <% if string.len(scutclient_version) > 1 then %> 已安装版本: - <%=get_client_version("scutclient")%> + <%=scutclient_version%> <% else %> scutclient未安装 <% end %> diff --git a/package/ntlf9t/scutclient/Makefile b/package/ntlf9t/scutclient/Makefile index 74fdc22214..af533a6fdf 100644 --- a/package/ntlf9t/scutclient/Makefile +++ b/package/ntlf9t/scutclient/Makefile @@ -8,22 +8,17 @@ include $(TOPDIR)/rules.mk PKG_NAME:=scutclient -#If you want to compile your local source code, fill the absolute source path below. -SRCDIR:= -ifneq (,$(SRCDIR)) -PKG_VERSION:=$(shell cd $(SRCDIR) && git describe --tags || echo "debug") -PKG_RELEASE:=1 -PKG_UNPACK=$(CP) $(SRCDIR)/. $(PKG_BUILD_DIR) -else -PKG_VERSION:=3.1.1 +PKG_VERSION:=3.1.2 PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=https://github.com/scutclient/scutclient.git -PKG_SOURCE_VERSION:=v$(PKG_VERSION) +PKG_REV:=10d0c13cc5902925c479f1d50a68564c3129aebc + +PKG_SOURCE_VERSION:=$(PKG_REV) PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz -endif +PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.gz +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR) PKG_MAINTAINER:=Scutclient Project @@ -33,17 +28,18 @@ PKG_FIXUP:=autoreconf PKG_BUILD_PARALLEL:=1 include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/cmake.mk define Package/scutclient SECTION:=net CATEGORY:=Network TITLE:=SCUT Dr.com client - DEPENDS:= - URL:= + URL:=https://github.com/scutclient/scutclient + SUBMENU:=Campus Network endef define Package/scutclient/description - Support SCUT private authentication protocol. + Support SCUT private authentication protocol. endef define Package/scutclient/conffiles diff --git a/package/ntlf9t/scutclient/files/scutclient.config b/package/ntlf9t/scutclient/files/scutclient.config index a5084cc4d3..84b19b1891 100755 --- a/package/ntlf9t/scutclient/files/scutclient.config +++ b/package/ntlf9t/scutclient/files/scutclient.config @@ -4,8 +4,6 @@ config option option debug '0' config scutclient - option password '' - option username '' config drcom option hostname 'Lenovo-PC' @@ -13,4 +11,4 @@ config drcom option version '4472434f4d0096022a' option hash '2ec15ad258aee9604b18f2f8114da38db16efd00' option dns '222.201.130.30' - option authexe '/etc/init.d/sysntpd restart' + option onlinehook '/etc/init.d/sysntpd restart' diff --git a/package/ntlf9t/scutclient/files/scutclient.hotplug b/package/ntlf9t/scutclient/files/scutclient.hotplug index 099addbae5..4dc9b63b11 100755 --- a/package/ntlf9t/scutclient/files/scutclient.hotplug +++ b/package/ntlf9t/scutclient/files/scutclient.hotplug @@ -5,4 +5,4 @@ network_find_wan wan_net_name [ "$(uci get scutclient.@option[-1].enable)" = "1" ] && \ [ "$wan_net_name" = "$INTERFACE" ] || exit 0 pgrep -x /usr/bin/scutclient > /dev/null && exit 0 -/etc/init.d/scutclient restart \ No newline at end of file +/etc/init.d/scutclient restart diff --git a/package/ntlf9t/scutclient/files/scutclient.init b/package/ntlf9t/scutclient/files/scutclient.init index 6b3dea400a..b4cd3f12f9 100755 --- a/package/ntlf9t/scutclient/files/scutclient.init +++ b/package/ntlf9t/scutclient/files/scutclient.init @@ -18,7 +18,8 @@ scutclient_validate_drcom() { 'hostname:string:Lenovo-PC' \ 'server_auth_ip:ip4addr:202.38.210.131' \ 'version:string:4472434f4d0096022a' \ - 'authexe:string' \ + 'onlinehook:string' \ + 'offlinehook:string' \ 'nettime:string' \ 'hash:string:2ec15ad258aee9604b18f2f8114da38db16efd00' || exit 1 } @@ -61,7 +62,8 @@ scutclient_start_instance() { --cli-version "$version" \ --hash "$hash" [ "$debug" -ge 1 ] && procd_append_param command --debug - [ -n "$authexe" ] && procd_append_param command --auth-exec "$authexe" + [ -n "$onlinehook" ] && procd_append_param command --online-hook "$onlinehook" + [ -n "$offlinehook" ] && procd_append_param command --offline-hook "$offlinehook" [ -n "$nettime" ] && procd_append_param command --net-time "$nettime" procd_close_instance } @@ -111,4 +113,4 @@ reload_service() { boot() { return -} \ No newline at end of file +}