scutclient: update to latest git HEAD

This commit is contained in:
AmadeusGhost 2021-01-07 11:18:06 +08:00
parent 09ba2f11a7
commit a6a5db037d
4 changed files with 2 additions and 140 deletions

View File

@ -13,10 +13,9 @@ PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/scutclient/scutclient.git
PKG_MIRROR_HASH:=31e598d418956e236de287834f9553026f7853b06c5ba091fbf6f933bc305116
PKG_REV:=10d0c13cc5902925c479f1d50a68564c3129aebc
PKG_SOURCE_VERSION:=36128216c63f8954371e64d78ff30bca5e73a882
PKG_MIRROR_HASH:=ffce8508a7d083150d6484b7272ea832432dcfde9ad8773c2a6d1785bef41191
PKG_SOURCE_VERSION:=$(PKG_REV)
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.gz
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR)
@ -24,8 +23,6 @@ PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_SUBDIR)
PKG_MAINTAINER:=Scutclient Project
PKG_LICENSE:=AGPL-3.0
PKG_FIXUP:=autoreconf
PKG_BUILD_PARALLEL:=1
include $(INCLUDE_DIR)/package.mk

View File

@ -1,14 +0,0 @@
config option
option enable '1'
option debug '0'
config scutclient
config drcom
option hostname 'Lenovo-PC'
option server_auth_ip '202.38.210.131'
option version '4472434f4d0096022a'
option hash '2ec15ad258aee9604b18f2f8114da38db16efd00'
option dns '222.201.130.30'
option onlinehook '/etc/init.d/sysntpd restart'

View File

@ -1,8 +0,0 @@
. /lib/functions.sh
. /lib/functions/network.sh
network_find_wan wan_net_name
[ "$ACTION" = "ifup" ] && \
[ "$(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

View File

@ -1,113 +0,0 @@
#!/bin/sh /etc/rc.common
START=99
STOP=15
USE_PROCD=1
SCUTCLIENT_PATH=/usr/bin/scutclient
SCUTCLIENT_CONFIG=scutclient
extra_command "logoff" "Log off manually"
scutclient_validate_drcom() {
uci_validate_section scutclient drcom "${1}" \
'dns:ip4addr:222.201.130.30' \
'hostname:string:Lenovo-PC' \
'server_auth_ip:ip4addr:202.38.210.131' \
'version:string:4472434f4d0096022a' \
'onlinehook:string' \
'offlinehook:string' \
'nettime:string' \
'hash:string:2ec15ad258aee9604b18f2f8114da38db16efd00' || exit 1
}
scutclient_validate_scutclient() {
uci_validate_section scutclient scutclient "${1}" \
'username:string' \
'password:string' \
'interface:string:wan' || exit 1
}
scutclient_validate_option() {
uci_validate_section scutclient option "${1}" \
'enable:bool:0' \
'debug:bool:0' || exit 1
}
scutclient_load_config() {
config_load scutclient
config_foreach scutclient_validate_option option
config_foreach scutclient_validate_drcom drcom
}
scutclient_start_instance() {
local cfg="$1"
local username password interface ifname
scutclient_validate_scutclient "$cfg"
uci_validate_section network interface "$interface" 'ifname:string'
procd_open_instance "scutclient_${cfg}_${interface}"
procd_set_param stdout 1
procd_set_param stderr 1
procd_set_param netdev $ifname
procd_set_param command "$SCUTCLIENT_PATH"
procd_append_param command --username "$username" \
--password "$password" \
--iface "$ifname" \
--dns "$dns" \
--hostname "$hostname" \
--udp-server "$server_auth_ip" \
--cli-version "$version" \
--hash "$hash"
[ "$debug" -ge 1 ] && procd_append_param command --debug
[ -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
}
scutclient_add_triggers() {
local cfg="$1"
local username password interface
scutclient_validate_scutclient "$cfg"
procd_add_interface_trigger "interface.*" $interface /etc/init.d/scutclient restart
}
scutclient_logoff() {
local cfg="$1"
local username password interface ifname
scutclient_validate_scutclient "$cfg"
uci_validate_section network interface "$interface" 'ifname:string'
$SCUTCLIENT_PATH --iface $ifname --logoff
}
service_triggers() {
local enable debug
config_load scutclient
config_foreach scutclient_validate_option option
config_foreach scutclient_add_triggers scutclient
#wan force_link is enabled by default when configured as static IP, which won't trigger hotplug events.
#Add wan6 and dhcp here as a backup.
procd_add_interface_trigger "interface.*" wan6 /etc/init.d/scutclient restart
procd_add_reload_trigger "dhcp"
procd_add_reload_trigger "$SCUTCLIENT_CONFIG"
procd_open_validate
scutclient_validate_option
scutclient_validate_scutclient
scutclient_validate_drcom
procd_close_validate
}
start_service() {
local dns hostname server_auth_ip version hash username password enable debug ifname authexe nettime
scutclient_load_config
[ $enable -eq 0 ] && exit
config_foreach scutclient_start_instance scutclient
}
reload_service() {
restart
}
boot() {
return
}