From 55dfa942cec52a5278069a55161fb9257de7abe2 Mon Sep 17 00:00:00 2001 From: Puqns67 Date: Sun, 4 Feb 2024 17:08:41 +0800 Subject: [PATCH] net-dns/ddns-go: add 6.1.1, drop 5.7.0 --- net-dns/ddns-go/Manifest | 4 +- ...s-go-5.7.0.ebuild => ddns-go-6.1.1.ebuild} | 26 +++--- .../ddns-go-5.6.6-remove-update-support.patch | 45 ---------- ...1-remove-service-management-support.patch} | 87 ++++++++++--------- .../ddns-go-6.1.1-remove-update-support.patch | 45 ++++++++++ 5 files changed, 103 insertions(+), 104 deletions(-) rename net-dns/ddns-go/{ddns-go-5.7.0.ebuild => ddns-go-6.1.1.ebuild} (57%) delete mode 100644 net-dns/ddns-go/files/ddns-go-5.6.6-remove-update-support.patch rename net-dns/ddns-go/files/{ddns-go-5.7.0-remove-service-management-support.patch => ddns-go-6.1.1-remove-service-management-support.patch} (72%) create mode 100644 net-dns/ddns-go/files/ddns-go-6.1.1-remove-update-support.patch diff --git a/net-dns/ddns-go/Manifest b/net-dns/ddns-go/Manifest index 7bebc1e..1668b84 100644 --- a/net-dns/ddns-go/Manifest +++ b/net-dns/ddns-go/Manifest @@ -1,2 +1,2 @@ -DIST ddns-go-5.7.0-deps.tar.xz 2747980 BLAKE2B 8370823ff1f670b38390547342a7eb2afa1d4767071d1eb840d86462c06d923ffd5afe24d1dc3f8fb306301f5c9b72bf82e9fc1cf8cb11f2ed83dd2073a03fef SHA512 c1b72eca1b3144b2fcd614014be64c1b2ab327063ffb4b8d9f3c0b969429aaf850897dc2fc406c266a0bb07b05b1c67034981e0dc03f03511111691b01adacad -DIST ddns-go-5.7.0.tar.gz 145235 BLAKE2B f315649db37c70da84de6f70647ec291fd1b608747fec64e715d0c8e882987eac9ee37b8087e0bb3e3f97007f0655af88ce01a8d3d33f1855bc822992b8f42c1 SHA512 96421eeaa06f4bac98f76038fc925eaf1fd5fd7cbfad2faa00c85c58e85e71e2ec0b074cd7ae460a12a888a81c53b18ec019e9c72f9e4185b3e9f43edb189895 +DIST ddns-go-6.1.1-deps.tar.xz 14654396 BLAKE2B 185b56b2e0d8c3c468646d045bb25ca58a72bfb98c3b29400585c5ed562d24c3b4cd6ff85c5a3aa797062e5a010b862e333538223fbe42c46825965f36bc5952 SHA512 2265896285a7995f33d4c4c157be24b73af192c924b8623c0544d5cf3920d0dcc3d30493ffbd5284e39cf347bf4b54d0e284188d4829cf3c794e1656ca179aa8 +DIST ddns-go-6.1.1.tar.gz 149525 BLAKE2B 26fba1ee8a54b472ede55beb721ac188462390e29ff9e0699190f0d22624ca3f992ea363224b0bf97d70eb36913f001e0cf8452191fd27d84b44ec9f2b8405c6 SHA512 88378853be34e5be3707429746b98f7d8f3f53e84929c2597f5c6efe6b0c431e52dc07963d5a7bdae1f0e4c0cd851956bdb6e43e38af4b76b5eb9f3cd751fa8b diff --git a/net-dns/ddns-go/ddns-go-5.7.0.ebuild b/net-dns/ddns-go/ddns-go-6.1.1.ebuild similarity index 57% rename from net-dns/ddns-go/ddns-go-5.7.0.ebuild rename to net-dns/ddns-go/ddns-go-6.1.1.ebuild index f2d870a..bea5483 100644 --- a/net-dns/ddns-go/ddns-go-5.7.0.ebuild +++ b/net-dns/ddns-go/ddns-go-6.1.1.ebuild @@ -10,36 +10,32 @@ HOMEPAGE="https://github.com/jeessy2/ddns-go" SRC_URI="https://github.com/jeessy2/ddns-go/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz https://github.com/Puqns67/gentoo-deps/releases/download/${P}/${P}-deps.tar.xz" -LICENSE="MIT" +LICENSE="MIT BSD" SLOT="0" KEYWORDS="~amd64 ~riscv" RESTRICT="mirror" -DEPEND="" -RDEPEND="${DEPEND}" -BDEPEND=">=dev-lang/go-1.20" - PATCHES=( - "${FILESDIR}/ddns-go-5.6.6-remove-update-support.patch" - "${FILESDIR}/ddns-go-5.7.0-remove-service-management-support.patch" + "${FILESDIR}/${P}-remove-update-support.patch" + "${FILESDIR}/${P}-remove-service-management-support.patch" ) src_compile() { ego build \ -trimpath \ - -ldflags="-s -w \ + -ldflags="-s -w -linkmode external \ -X 'main.version=${PV}' \ -X 'main.buildTime=$(date -u +"%Y-%m-%dT%H:%M:%SZ")'" \ - -o ddns-go \ + -o "${PN}" \ . } src_install() { - dobin ddns-go - systemd_dounit "${FILESDIR}/ddns-go.service" - systemd_newunit "${FILESDIR}/ddns-go_at.service" ddns-go@.service - systemd_dounit "${FILESDIR}/ddns-go-web.service" - systemd_newunit "${FILESDIR}/ddns-go-web_at.service" ddns-go-web@.service - keepdir /etc/ddns-go + dobin "${PN}" + systemd_dounit "${FILESDIR}/${PN}.service" + systemd_newunit "${FILESDIR}/${PN}_at.service" "${PN}@.service" + systemd_dounit "${FILESDIR}/${PN}-web.service" + systemd_newunit "${FILESDIR}/${PN}-web_at.service" "${PN}-web@.service" + keepdir /etc/${PN} } diff --git a/net-dns/ddns-go/files/ddns-go-5.6.6-remove-update-support.patch b/net-dns/ddns-go/files/ddns-go-5.6.6-remove-update-support.patch deleted file mode 100644 index ece0f5b..0000000 --- a/net-dns/ddns-go/files/ddns-go-5.6.6-remove-update-support.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 01f9502e859a68e4084cd9347b63b62a4183a26b Mon Sep 17 00:00:00 2001 -From: Puqns67 -Date: Sun, 3 Dec 2023 17:17:25 +0800 -Subject: [PATCH 1/2] build: remove update support for this build - ---- - main.go | 8 -------- - 1 file changed, 8 deletions(-) - -diff --git a/main.go b/main.go -index 1272697..4896399 100644 ---- a/main.go -+++ b/main.go -@@ -16,7 +16,6 @@ import ( - "github.com/jeessy2/ddns-go/v5/config" - "github.com/jeessy2/ddns-go/v5/dns" - "github.com/jeessy2/ddns-go/v5/util" -- "github.com/jeessy2/ddns-go/v5/util/update" - "github.com/jeessy2/ddns-go/v5/web" - "github.com/kardianos/service" - ) -@@ -25,9 +24,6 @@ import ( - // ddns-go version - var versionFlag = flag.Bool("v", false, "ddns-go 版本") - --// 更新 ddns-go --var updateFlag = flag.Bool("u", false, "更新 ddns-go") -- - // 监听地址 - var listen = flag.String("l", ":9876", "监听地址") - -@@ -67,10 +63,6 @@ func main() { - fmt.Println(version) - return - } -- if *updateFlag { -- update.Self(version) -- return -- } - if _, err := net.ResolveTCPAddr("tcp", *listen); err != nil { - log.Fatalf("解析监听地址异常,%s", err) - } --- -2.43.0 - diff --git a/net-dns/ddns-go/files/ddns-go-5.7.0-remove-service-management-support.patch b/net-dns/ddns-go/files/ddns-go-6.1.1-remove-service-management-support.patch similarity index 72% rename from net-dns/ddns-go/files/ddns-go-5.7.0-remove-service-management-support.patch rename to net-dns/ddns-go/files/ddns-go-6.1.1-remove-service-management-support.patch index 8ef92d4..e8ba277 100644 --- a/net-dns/ddns-go/files/ddns-go-5.7.0-remove-service-management-support.patch +++ b/net-dns/ddns-go/files/ddns-go-6.1.1-remove-service-management-support.patch @@ -1,31 +1,35 @@ -From b19d31496a6031050b91dbd02a66b2ec05ac729d Mon Sep 17 00:00:00 2001 +From 12a957f7e34eae070ac759e829038e6b91fda7ab Mon Sep 17 00:00:00 2001 From: Puqns67 Date: Sun, 24 Dec 2023 22:21:38 +0800 Subject: [PATCH 2/2] build: remove service management support for this build --- - go.mod | 3 - + go.mod | 7 +- go.sum | 5 -- - main.go | 223 +------------------------------------------------------- - 3 files changed, 1 insertion(+), 230 deletions(-) + main.go | 222 +------------------------------------------------------- + 3 files changed, 2 insertions(+), 232 deletions(-) diff --git a/go.mod b/go.mod -index 08b144c..61ea627 100644 +index fcc9d3c..5311a1c 100644 --- a/go.mod +++ b/go.mod -@@ -3,10 +3,7 @@ module github.com/jeessy2/ddns-go/v5 +@@ -3,13 +3,8 @@ module github.com/jeessy2/ddns-go/v6 go 1.20 require ( - github.com/kardianos/service v1.2.2 github.com/wagslane/go-password-validator v0.3.0 - golang.org/x/net v0.19.0 - gopkg.in/yaml.v3 v3.0.1 - ) + golang.org/x/net v0.20.0 +- gopkg.in/yaml.v3 v3.0.1 +-) - --require golang.org/x/sys v0.15.0 // indirect +-require ( +- golang.org/x/sys v0.16.0 // indirect + golang.org/x/text v0.14.0 ++ gopkg.in/yaml.v3 v3.0.1 + ) diff --git a/go.sum b/go.sum -index ff968b0..802389b 100644 +index 062bd88..7e61244 100644 --- a/go.sum +++ b/go.sum @@ -1,12 +1,7 @@ @@ -33,19 +37,19 @@ index ff968b0..802389b 100644 -github.com/kardianos/service v1.2.2/go.mod h1:CIMRFEJVL+0DS1a3Nx06NaMn4Dz63Ng6O7dl0qH0zVM= github.com/wagslane/go-password-validator v0.3.0 h1:vfxOPzGHkz5S146HDpavl0cw1DSVP061Ry2PX0/ON6I= github.com/wagslane/go-password-validator v0.3.0/go.mod h1:TI1XJ6T5fRdRnHqHt14pvy1tNVnrwe7m3/f1f2fDphQ= - golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= - golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= + golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= + golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= -golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= --golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= --golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +-golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU= +-golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= + golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= + golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= - gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= - gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/main.go b/main.go -index 5b164ba..eae04be 100644 +index 32eca51..42672df 100644 --- a/main.go +++ b/main.go -@@ -8,7 +8,6 @@ import ( +@@ -9,7 +9,6 @@ import ( "net" "net/http" "os" @@ -53,25 +57,25 @@ index 5b164ba..eae04be 100644 "path/filepath" "strconv" "strings" -@@ -18,7 +17,6 @@ import ( - "github.com/jeessy2/ddns-go/v5/dns" - "github.com/jeessy2/ddns-go/v5/util" - "github.com/jeessy2/ddns-go/v5/web" +@@ -19,7 +18,6 @@ import ( + "github.com/jeessy2/ddns-go/v6/dns" + "github.com/jeessy2/ddns-go/v6/util" + "github.com/jeessy2/ddns-go/v6/web" - "github.com/kardianos/service" ) // ddns-go 版本 -@@ -34,9 +32,6 @@ var every = flag.Int("f", 300, "同步间隔时间(秒)") +@@ -35,9 +33,6 @@ var every = flag.Int("f", 300, "Sync frequency(seconds)") // 缓存次数 - var ipCacheTimes = flag.Int("cacheTimes", 5, "间隔N次与服务商比对") + var ipCacheTimes = flag.Int("cacheTimes", 5, "Interval N times compared with service providers") -// 服务管理 --var serviceType = flag.String("s", "", "服务管理, 支持install, uninstall, restart") +-var serviceType = flag.String("s", "", "Service management (install|uninstall|restart)") - // 配置文件路径 - var configFilePath = flag.String("c", util.GetConfigFilePathDefault(), "自定义配置文件路径") + var configFilePath = flag.String("c", util.GetConfigFilePathDefault(), "config file path") -@@ -83,34 +78,7 @@ func main() { +@@ -84,34 +79,7 @@ func main() { } } os.Setenv(util.IPCacheTimesENV, strconv.Itoa(*ipCacheTimes)) @@ -95,9 +99,9 @@ index 5b164ba..eae04be 100644 - // 非服务方式运行 - switch s.Platform() { - case "windows-service": -- log.Println("可使用 .\\ddns-go.exe -s install 安装服务运行") +- util.Log("可使用 .\\ddns-go.exe -s install 安装服务运行") - default: -- log.Println("可使用 sudo ./ddns-go -s install 安装服务运行") +- util.Log("可使用 sudo ./ddns-go -s install 安装服务运行") - } - run() - } @@ -107,7 +111,7 @@ index 5b164ba..eae04be 100644 } func run() { -@@ -168,131 +136,6 @@ func runWebServer() error { +@@ -169,130 +137,6 @@ func runWebServer() error { return http.Serve(l, nil) } @@ -146,7 +150,7 @@ index 5b164ba..eae04be 100644 - svcConfig := &service.Config{ - Name: "ddns-go", - DisplayName: "ddns-go", -- Description: "简单好用的DDNS。自动更新域名解析到公网IP(支持阿里云、腾讯云dnspod、Cloudflare、Callback、华为云、百度云、Porkbun、GoDaddy、Google Domain)", +- Description: "Simple and easy to use DDNS. Automatically update domain name resolution to public IP (Support Aliyun, Tencent Cloud, Dnspod, Cloudflare, Callback, Huawei Cloud, Baidu Cloud, Porkbun, GoDaddy...)", - Arguments: []string{"-l", *listen, "-f", strconv.Itoa(*every), "-cacheTimes", strconv.Itoa(*ipCacheTimes), "-c", *configFilePath}, - Dependencies: depends, - Option: options, @@ -182,9 +186,9 @@ index 5b164ba..eae04be 100644 - } - } - if err := s.Uninstall(); err == nil { -- log.Println("ddns-go 服务卸载成功!") +- util.Log("ddns-go 服务卸载成功") - } else { -- log.Printf("ddns-go 服务卸载失败, ERR: %s\n", err) +- util.Log("ddns-go 服务卸载失败, 异常信息: %s", err) - } -} - @@ -197,7 +201,7 @@ index 5b164ba..eae04be 100644 - // 服务未知,创建服务 - if err = s.Install(); err == nil { - s.Start() -- log.Println("安装 ddns-go 服务成功! 请打开浏览器并进行配置。") +- util.Log("安装 ddns-go 服务成功! 请打开浏览器并进行配置") - if service.ChosenSystem().String() == "unix-systemv" { - if _, err := exec.Command("/etc/init.d/ddns-go", "enable").Output(); err != nil { - log.Println(err) @@ -208,12 +212,11 @@ index 5b164ba..eae04be 100644 - } - return - } -- -- log.Printf("安装 ddns-go 服务失败, ERR: %s\n", err) +- util.Log("安装 ddns-go 服务失败, 异常信息: %s", err) - } - - if status != service.StatusUnknown { -- log.Println("ddns-go 服务已安装, 无需再次安装") +- util.Log("ddns-go 服务已安装, 无需再次安装") - } -} - @@ -224,22 +227,22 @@ index 5b164ba..eae04be 100644 - if err == nil { - if status == service.StatusRunning { - if err = s.Restart(); err == nil { -- log.Println("重启 ddns-go 服务成功!") +- util.Log("重启 ddns-go 服务成功") - } - } else if status == service.StatusStopped { - if err = s.Start(); err == nil { -- log.Println("启动 ddns-go 服务成功!") +- util.Log("启动 ddns-go 服务成功") - } - } - } else { -- log.Println("ddns-go 服务未安装, 请先安装服务") +- util.Log("ddns-go 服务未安装, 请先安装服务") - } -} - // 打开浏览器 func autoOpenExplorer() { _, err := config.GetConfigCached() -@@ -315,67 +158,3 @@ func autoOpenExplorer() { +@@ -315,67 +159,3 @@ func autoOpenExplorer() { } } } diff --git a/net-dns/ddns-go/files/ddns-go-6.1.1-remove-update-support.patch b/net-dns/ddns-go/files/ddns-go-6.1.1-remove-update-support.patch new file mode 100644 index 0000000..5be1c96 --- /dev/null +++ b/net-dns/ddns-go/files/ddns-go-6.1.1-remove-update-support.patch @@ -0,0 +1,45 @@ +From fcc3687222a2d90c6ad05df3c3acfe581d5b3493 Mon Sep 17 00:00:00 2001 +From: Puqns67 +Date: Sun, 3 Dec 2023 17:17:25 +0800 +Subject: [PATCH 1/2] build: remove update support for this build + +--- + main.go | 8 -------- + 1 file changed, 8 deletions(-) + +diff --git a/main.go b/main.go +index 4120214..32eca51 100644 +--- a/main.go ++++ b/main.go +@@ -18,7 +18,6 @@ import ( + "github.com/jeessy2/ddns-go/v6/config" + "github.com/jeessy2/ddns-go/v6/dns" + "github.com/jeessy2/ddns-go/v6/util" +- "github.com/jeessy2/ddns-go/v6/util/update" + "github.com/jeessy2/ddns-go/v6/web" + "github.com/kardianos/service" + ) +@@ -27,9 +26,6 @@ import ( + // ddns-go version + var versionFlag = flag.Bool("v", false, "ddns-go version") + +-// 更新 ddns-go +-var updateFlag = flag.Bool("u", false, "Upgrade ddns-go to the latest version") +- + // 监听地址 + var listen = flag.String("l", ":9876", "Listen address") + +@@ -69,10 +65,6 @@ func main() { + fmt.Println(version) + return + } +- if *updateFlag { +- update.Self(version) +- return +- } + if _, err := net.ResolveTCPAddr("tcp", *listen); err != nil { + log.Fatalf("Parse listen address failed! Exception: %s", err) + } +-- +2.43.0 +