scutclient: update to 3.1.2

This commit is contained in:
AmadeusGhost 2020-04-21 12:01:39 +08:00
parent e91175b592
commit 5b0196da80
6 changed files with 37 additions and 36 deletions

View File

@ -1,5 +1,5 @@
#
# Copyright (C) 2008-2014 The LuCI Team <luci@lists.subsignal.org>
# 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

View File

@ -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
</tr>
<tr class="cbi-section-table-row cbi-rowstyle-2">
<% if get_client_version("scutclient") then %>
<% if string.len(scutclient_version) > 1 then %>
<td width="33%"><strong>已安装版本:</strong></td>
<td><%=get_client_version("scutclient")%></td>
<td><%=scutclient_version%></td>
<% else %>
<td style="color: red;"><strong>scutclient未安装</strong></td>
<% end %>

View File

@ -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

View File

@ -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'

View File

@ -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
/etc/init.d/scutclient restart

View File

@ -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
}
}