summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authordevome2024-01-12 18:10:49 +0800
committerdevome2024-01-12 18:10:49 +0800
commit7d37453f29b07ebf85ba1b432a7f9006aae4c364 (patch)
tree5861ef367b5dda5a3d46010164cf27366346b629
parent94df8ccead0ce1f97c88d1e4c7ce5cddee78e0a9 (diff)
downloadaur-7d37453f29b07ebf85ba1b432a7f9006aae4c364.tar.gz
ddns-go: 6.0.1-1
-rw-r--r--.SRCINFO30
-rw-r--r--.gitignore8
-rw-r--r--PKGBUILD69
-rw-r--r--ddns-go.env19
-rw-r--r--ddns-go.install41
-rw-r--r--ddns-go.service17
-rw-r--r--ddns-go.sysusers1
-rw-r--r--ddns-go.user.service13
8 files changed, 152 insertions, 46 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 7bc247385d10..900b17d841c8 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,24 +1,30 @@
pkgbase = ddns-go
- pkgdesc = 简单好用的DDNS。自动更新域名解析到公网IP(支持阿里云、腾讯云dnspod、Cloudflare、华为云)
- pkgver = 5.6.2
+ pkgdesc = A simple, easy-to-use ddns service | 简单好用的DDNS
+ pkgver = 6.0.1
pkgrel = 1
url = https://github.com/jeessy2/ddns-go
+ install = ddns-go.install
arch = x86_64
- arch = i686
arch = aarch64
+ arch = armv7h
arch = armv6h
license = MIT
+ makedepends = git
+ makedepends = go
+ depends = glibc
provides = ddns-go
conflicts = ddns-go
+ backup = etc/ddns-go/ddns-go.env
+ backup = etc/ddns-go/config.yml
+ source = ddns-go::git+https://github.com/jeessy2/ddns-go
+ source = ddns-go.env
source = ddns-go.service
- sha256sums = c264ee5afaee8abed884cdd167f2e3281e08c3d74778790263163c114cd650d5
- source_x86_64 = https://github.com/jeessy2/ddns-go/releases/download/v5.6.2/ddns-go_5.6.2_Linux_x86_64.tar.gz
- sha256sums_x86_64 = 853d60a72e998b81335891697a038a245e86f1a7f8a6682d2200f7544edcbda0
- source_i686 = https://github.com/jeessy2/ddns-go/releases/download/v5.6.2/ddns-go_5.6.2_Linux_i386.tar.gz
- sha256sums_i686 = 0ec2c1d7646c0907d3a71d0665bb290583f4043f644722e3267d2c6228cb05ef
- source_aarch64 = https://github.com/jeessy2/ddns-go/releases/download/v5.6.2/ddns-go_5.6.2_Linux_arm64.tar.gz
- sha256sums_aarch64 = 2d4c1e10b6adfbc6e94fff8e3200fca1574f3538b0b5690be3e303b90c8279d8
- source_armv6h = https://github.com/jeessy2/ddns-go/releases/download/v5.6.2/ddns-go_5.6.2_Linux_armv6.tar.gz
- sha256sums_armv6h = 86a8ac7ca51c906ebab2b29f2e9eed5a4ec9cd34189864516cc430627710c735
+ source = ddns-go.sysusers
+ source = ddns-go.user.service
+ sha256sums = SKIP
+ sha256sums = adc5116f5b965e642a826dd2ac5680a112b85b89963658dae18242cffb9224dc
+ sha256sums = f1d7ee4f2ef6c13270ff7e3b9f17a35c5faba76e7601a81cc0ac75da9e27f724
+ sha256sums = 558a170cae11f423591c5487dfe5f5e72f4aa88aaf62055f79a6656b6a98235a
+ sha256sums = e6f40c329735dca3d1bd4597ffe0545c81db814499f4363a2df033f4e41a371d
pkgname = ddns-go
diff --git a/.gitignore b/.gitignore
index 8ab34310c28d..d2ab8594151d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,5 @@
+ddns-go
src
pkg
-*.zst
-*.asar
-*.xz
-*.tar
-*.gz
+*.pkg.tar.zst
+*.tar.gz
diff --git a/PKGBUILD b/PKGBUILD
index fea126797411..c11a92c31997 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,26 +1,51 @@
-_pkgname=ddns-go
-pkgname=${_pkgname}
-pkgver=5.6.2
+pkgname="ddns-go"
+pkgver=6.0.1
pkgrel=1
-pkgdesc='简单好用的DDNS。自动更新域名解析到公网IP(支持阿里云、腾讯云dnspod、Cloudflare、华为云)'
+pkgdesc="A simple, easy-to-use ddns service | 简单好用的DDNS"
license=('MIT')
-arch=('x86_64' 'i686' 'aarch64' 'armv6h')
-url="https://github.com/jeessy2/${_pkgname}"
-provides=(${_pkgname})
-conflicts=(${_pkgname})
-source=(${_pkgname}.service)
-source_x86_64=("https://github.com/jeessy2/${_pkgname}/releases/download/v${pkgver}/${_pkgname}_${pkgver}_Linux_x86_64.tar.gz")
-source_i686=("https://github.com/jeessy2/${_pkgname}/releases/download/v${pkgver}/${_pkgname}_${pkgver}_Linux_i386.tar.gz")
-source_aarch64=("https://github.com/jeessy2/${_pkgname}/releases/download/v${pkgver}/${_pkgname}_${pkgver}_Linux_arm64.tar.gz")
-source_armv6h=("https://github.com/jeessy2/${_pkgname}/releases/download/v${pkgver}/${_pkgname}_${pkgver}_Linux_armv6.tar.gz")
-sha256sums=('c264ee5afaee8abed884cdd167f2e3281e08c3d74778790263163c114cd650d5')
-sha256sums_x86_64=('853d60a72e998b81335891697a038a245e86f1a7f8a6682d2200f7544edcbda0')
-sha256sums_i686=('0ec2c1d7646c0907d3a71d0665bb290583f4043f644722e3267d2c6228cb05ef')
-sha256sums_aarch64=('2d4c1e10b6adfbc6e94fff8e3200fca1574f3538b0b5690be3e303b90c8279d8')
-sha256sums_armv6h=('86a8ac7ca51c906ebab2b29f2e9eed5a4ec9cd34189864516cc430627710c735')
-
+arch=("x86_64" "aarch64" "armv7h" "armv6h")
+url="https://github.com/jeessy2/${pkgname}"
+provides=("${pkgname}")
+conflicts=("${pkgname}")
+backup=("etc/${pkgname}/${pkgname}.env" "etc/${pkgname}/config.yml")
+install="${pkgname}.install"
+license=("MIT")
+depends=("glibc")
+makedepends=("git" "go")
+source=("${pkgname}::git+${url}"
+ "${pkgname}.env"
+ "${pkgname}.service"
+ "${pkgname}.sysusers"
+ "${pkgname}.user.service")
+sha256sums=('SKIP'
+ 'adc5116f5b965e642a826dd2ac5680a112b85b89963658dae18242cffb9224dc'
+ 'f1d7ee4f2ef6c13270ff7e3b9f17a35c5faba76e7601a81cc0ac75da9e27f724'
+ '558a170cae11f423591c5487dfe5f5e72f4aa88aaf62055f79a6656b6a98235a'
+ 'e6f40c329735dca3d1bd4597ffe0545c81db814499f4363a2df033f4e41a371d')
+
+build() {
+ cd "${pkgname}"
+ git checkout "v${pkgver}"
+
+ local build_time="$(date -u +'%Y-%m-%dT%H:%M:%SZ')"
+ local ldflags=" \
+ -s -w \
+ -X main.version=${pkgver} \
+ -X main.buildTime=${build_time} \
+ -extldflags '${LDFLAGS}'
+ "
+ go build \
+ -trimpath \
+ -ldflags="$ldflags"
+}
+
package() {
- install -Dm755 "${_pkgname}" "${pkgdir}/usr/bin/${_pkgname}"
- install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${_pkgname}/LICENSE"
- install -Dm644 "${_pkgname}.service" "${pkgdir}/usr/lib/systemd/system/${_pkgname}.service"
+ install -Dm755 "${pkgname}/${pkgname}" "${pkgdir}/usr/bin/${pkgname}"
+ install -Dm644 "${pkgname}/LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
+ install -Dm644 "${pkgname}/README.md" "${pkgdir}/usr/share/doc/${pkgname}/README.md"
+ install -Dm644 "${pkgname}.env" "${pkgdir}/etc/${pkgname}/${pkgname}.env"
+ install -Dm644 "${pkgname}.service" "${pkgdir}/usr/lib/systemd/system/${pkgname}.service"
+ install -Dm644 "${pkgname}.user.service" "${pkgdir}/usr/lib/systemd/user/${pkgname}.service"
+ install -Dm644 "${pkgname}.sysusers" "${pkgdir}/usr/lib/sysusers.d/${pkgname}.conf"
+ touch "${pkgdir}/etc/${pkgname}/config.yml"
}
diff --git a/ddns-go.env b/ddns-go.env
new file mode 100644
index 000000000000..6b5304252a3b
--- /dev/null
+++ b/ddns-go.env
@@ -0,0 +1,19 @@
+## 运行ddns-go额外的参数
+## The extra parameters for run ddns-go
+
+# Usage of ddns-go:
+# -cacheTimes int
+# Interval N times compared with service providers (default 5)
+# -dns string
+# Custom DNS server, example: 8.8.8.8
+# -f int
+# Sync frequency(seconds) (default 300)
+# -l string
+# Listen address (default ":9876")
+# -noweb
+# No web service
+# -skipVerify
+# Skip certificate verification
+
+
+EXTRA_OPTS=""
diff --git a/ddns-go.install b/ddns-go.install
new file mode 100644
index 000000000000..7d49cb331017
--- /dev/null
+++ b/ddns-go.install
@@ -0,0 +1,41 @@
+#/usr/bin/env bash
+
+_pkgname="ddns-go"
+all_off="$(tput sgr0)"
+bold="${all_off}$(tput bold)"
+blue="${bold}$(tput setaf 4)"
+yellow="${bold}$(tput setaf 3)"
+
+note() {
+ printf "${blue}==>${yellow} NOTE:${bold} $1${all_off}\n"
+}
+
+post_install() {
+ chown -R "ddns-go:ddns-go" "/etc/$_pkgname"
+ if [[ $LANG == "zh_CN.UTF-8" ]]; then
+ note "从 6.0.1-1 开始,不再以 root 权限运行 $_pkgname ...
+ 可以以普通用户启用 $_pkgname: 'systemctl enable --user --now $_pkgname.service'...
+ 以普通用户运行时,配置文件为 '~/.config/$_pkgname/config.yml'...
+ 也可以以非root的系统用户启用:'sudo systemctl enable --now $_pkgname.service'...
+ 以系统用户运行时,配置文件为 '/etc/$_pkgname/config.yml'...
+ 以系统用户运行时,如需额外的命令行参数,请编辑 '/etc/$_pkgname/$_pkgname.env'..."
+ else
+ note "Starting from 6.0.1-1, no longer run $_pkgname with root user ...
+ You can enable as current regular user to run $_pkgname: 'systemctl enable --user --now $_pkgname.service'...
+ When running with the regular users, the configuration file is '~/.config/$_pkgname/config.yml' ...
+ Or you can also enable as a non root system user: 'sudo systemctl enable --now $_pkgname.service' ...
+ When running with the system users, the configuration file is '/etc/$_pkgname/config.yml' ...
+ When running with the system users, if you want to set extra options, you can edit '/etc/$_pkgname/$_pkgname.env' ..."
+ fi
+}
+
+post_upgrade() {
+ post_install
+ if (( "$(vercmp $2 6.0.1-1)" < 0 )); then
+ if [[ $LANG == "zh_CN.UTF-8" ]]; then
+ note "$_pkgname 系统用户的配置文件已移动至 '/etc/$_pkgname/config.yml'..."
+ else
+ note "Configuration of $_pkgname system user moved to '/etc/$_pkgname/config.yml' ..."
+ fi
+ fi
+}
diff --git a/ddns-go.service b/ddns-go.service
index 9b4afbc9c4c5..3a0f63de4e88 100644
--- a/ddns-go.service
+++ b/ddns-go.service
@@ -1,12 +1,15 @@
[Unit]
-Description=简单好用的DDNS。自动更新域名解析到公网IP(支持阿里云、腾讯云dnspod、Cloudflare、华为云)
+Description = A simple, easy-to-use ddns service.
+Wants = network-online.target
+After = network-online.target
[Service]
-StartLimitInterval=5
-StartLimitBurst=10
-ExecStart=/usr/bin/ddns-go "-l" ":9876" "-f" "300" "-c" "/etc/ddns-go.yaml"
-Restart=always
-RestartSec=120
+User = ddns-go
+Group = ddns-go
+EnvironmentFile = -/etc/ddns-go/ddns-go.env
+ExecStart = /usr/bin/ddns-go -c /etc/ddns-go/config.yml $EXTRA_OPTS
+Restart = always
+RestartSec = 5
[Install]
-WantedBy=multi-user.target
+WantedBy = multi-user.target
diff --git a/ddns-go.sysusers b/ddns-go.sysusers
new file mode 100644
index 000000000000..748aeed60fdc
--- /dev/null
+++ b/ddns-go.sysusers
@@ -0,0 +1 @@
+u "ddns-go" - "ddns-go" - -
diff --git a/ddns-go.user.service b/ddns-go.user.service
new file mode 100644
index 000000000000..065711198530
--- /dev/null
+++ b/ddns-go.user.service
@@ -0,0 +1,13 @@
+[Unit]
+Description = A simple, easy-to-use ddns service.
+Wants = network-online.target
+After = network-online.target
+
+[Service]
+ExecStart = /usr/bin/ddns-go -c .config/ddns-go/config.yml
+ExecStartPost = /usr/bin/mkdir -p .config/ddns-go
+Restart = always
+RestartSec = 5
+
+[Install]
+WantedBy = default.target