mirror of
https://github.com/kenzok8/openwrt-packages.git
synced 2025-01-09 03:58:26 +08:00
update 2024-02-19 23:40:23
This commit is contained in:
parent
f33bbfc34d
commit
9765f92136
@ -8,18 +8,16 @@
|
|||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=ddns-go
|
PKG_NAME:=ddns-go
|
||||||
KG_VERSION:=6.1.1
|
PKG_VERSION:=6.1.2
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=1
|
||||||
|
|
||||||
PKG_SOURCE_PROTO:=git
|
|
||||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||||
PKG_SOURCE_URL:=https://github.com/jeessy2/ddns-go.git
|
PKG_SOURCE_URL:=https://codeload.github.com/jeessy2/ddns-go/tar.gz/v$(PKG_VERSION)?
|
||||||
PKG_MIRROR_HASH:=738e16f09df958a8425e19fb717c1d2365632756babea2332e17d500b4ee1266
|
PKG_HASH:=6a8cb7be152ab398abfe7c63a8069f099f40417c4af0cae97db5dfdb4f81dc57
|
||||||
PKG_SOURCE_VERSION:=6410dad8a20411c75c8eca2026a2588ae355ccb1
|
|
||||||
|
|
||||||
PKG_LICENSE:=AGPL-3.0-only
|
PKG_LICENSE:=MIT
|
||||||
PKG_LICENSE_FILES:=LICENSE
|
PKG_LICENSE_FILES:=LICENSE
|
||||||
PKG_MAINTAINER:=herboy2008 <herboy2008@gmail.com>
|
PKG_MAINTAINER:=Tianling Shen <cnsztl@immortalwrt.org>
|
||||||
|
|
||||||
PKG_BUILD_DEPENDS:=golang/host
|
PKG_BUILD_DEPENDS:=golang/host
|
||||||
PKG_BUILD_PARALLEL:=1
|
PKG_BUILD_PARALLEL:=1
|
||||||
|
@ -10,26 +10,16 @@
|
|||||||
|
|
||||||
START=99
|
START=99
|
||||||
USE_PROCD=1
|
USE_PROCD=1
|
||||||
NAME=ddns-go
|
|
||||||
PROG=/usr/bin/ddns-go
|
PROG=/usr/bin/ddns-go
|
||||||
CONFDIR=/etc/ddns-go
|
CONFDIR=/etc/ddns-go
|
||||||
CONF=$CONFDIR/ddns-go-config.yaml
|
CONF=$CONFDIR/ddns-go-config.yaml
|
||||||
|
|
||||||
get_tz()
|
get_config() {
|
||||||
{
|
config_get_bool enabled $1 enabled 1
|
||||||
SET_TZ=""
|
config_get_bool logger $1 logger 1
|
||||||
|
config_get port $1 port 9876
|
||||||
[ -e "/etc/localtime" ] && return
|
config_get time $1 time 300
|
||||||
|
|
||||||
for tzfile in /etc/TZ /var/etc/TZ
|
|
||||||
do
|
|
||||||
[ -e "$tzfile" ] || continue
|
|
||||||
tz="$(cat $tzfile 2>/dev/null)"
|
|
||||||
done
|
|
||||||
|
|
||||||
[ -z "$tz" ] && return
|
|
||||||
|
|
||||||
SET_TZ=$tz
|
|
||||||
}
|
}
|
||||||
|
|
||||||
init_yaml(){
|
init_yaml(){
|
||||||
@ -37,46 +27,20 @@ init_yaml(){
|
|||||||
cat /usr/share/ddns-go/ddns-go-default.yaml > $CONF
|
cat /usr/share/ddns-go/ddns-go-default.yaml > $CONF
|
||||||
}
|
}
|
||||||
|
|
||||||
xappend() { param="$param $1"; }
|
start_service() {
|
||||||
|
config_load ddns-go
|
||||||
append_parm() {
|
config_foreach get_config basic
|
||||||
local section="$1"
|
[ x$enabled == x1 ] || return 1
|
||||||
local option="$2"
|
[ -s ${CONF} ] || init_yaml
|
||||||
local switch="$3"
|
logger -t ddns-go -p warn "ddns-go is start."
|
||||||
local default="$4"
|
echo "ddns-go is start."
|
||||||
local _tmp
|
|
||||||
config_get _tmp "$section" "$option" "$default"
|
|
||||||
[[ -z "$_tmp" ]] && return
|
|
||||||
[[ x$default = x && x$_tmp = x0 ]] && return
|
|
||||||
[[ x$default = x && x$_tmp = x1 ]] && xappend "$switch" || xappend "$switch $_tmp"
|
|
||||||
}
|
|
||||||
|
|
||||||
start_instance() {
|
|
||||||
local cfg="$1" param
|
|
||||||
config_get_bool enabled $cfg enabled 1
|
|
||||||
[[ x$enabled = x1 ]] || return 1
|
|
||||||
[[ -s ${CONF} ]] || init_yaml
|
|
||||||
config_get_bool logger $cfg logger 1
|
|
||||||
config_get port $cfg port '9876'
|
|
||||||
append_parm "$cfg" 'time' '-f' '300'
|
|
||||||
append_parm "$cfg" 'ctimes' '-cacheTimes' '5'
|
|
||||||
append_parm "$cfg" 'dns' '-dns' '223.5.5.5'
|
|
||||||
append_parm "$cfg" 'noweb' '-noweb'
|
|
||||||
append_parm "$cfg" 'skipverify' '-skipVerify'
|
|
||||||
procd_open_instance
|
procd_open_instance
|
||||||
get_tz
|
procd_set_param command $PROG -l :$port -f $time -c "$CONF"
|
||||||
[[ -z "$SET_TZ" ]] || procd_set_param env TZ="$SET_TZ"
|
[ "x$logger" == x1 ] && procd_set_param stderr 1
|
||||||
procd_set_param command ${PROG} -l :$port -c "$CONF" ${param}
|
|
||||||
[[ "x$logger" == x1 ]] && procd_set_param stderr 1
|
|
||||||
procd_set_param respawn
|
procd_set_param respawn
|
||||||
procd_close_instance
|
procd_close_instance
|
||||||
}
|
}
|
||||||
|
|
||||||
start_service() {
|
|
||||||
config_load 'ddns-go'
|
|
||||||
config_foreach start_instance 'basic'
|
|
||||||
}
|
|
||||||
|
|
||||||
service_triggers() {
|
service_triggers() {
|
||||||
procd_add_reload_trigger "ddns-go"
|
procd_add_reload_trigger "ddns-go"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user