From 768de840d7d5e5f0b7f98b49cb3d7bafe58e2361 Mon Sep 17 00:00:00 2001 From: Henry Chen Date: Mon, 6 Oct 2025 20:30:08 +0800 Subject: [PATCH] ss-tproxy: revamp maintainer scripts - remove prerm - no need to stop the oneshot unit before the upgrade - restart active units in postinst instead - also attempt to start enabled but inactive units - use git-based SRCS[^1] - make echoes more informative - reload the systemd configuration in postinst - use `is-active` in a more elegant manner - with `--quiet` we just need to know if systemctl returns 0 - silence systemd unit start failures in postinst as we should allow users to debug their own configurations later [^1]: https://github.blog/open-source/git/update-on-the-future-stability-of-source-code-archives-and-hashes/#future-stability-of-archives-and-hashes --- app-proxy/ss-tproxy/autobuild/postinst | 15 ++++++++++----- app-proxy/ss-tproxy/autobuild/prerm | 7 ------- app-proxy/ss-tproxy/spec | 5 +++-- 3 files changed, 13 insertions(+), 14 deletions(-) delete mode 100644 app-proxy/ss-tproxy/autobuild/prerm diff --git a/app-proxy/ss-tproxy/autobuild/postinst b/app-proxy/ss-tproxy/autobuild/postinst index 19f189ea420c..a3bdc24f378f 100644 --- a/app-proxy/ss-tproxy/autobuild/postinst +++ b/app-proxy/ss-tproxy/autobuild/postinst @@ -1,8 +1,13 @@ +echo "Refreshing systemd configurations ..." +systemctl daemon-reload -echo "Check whether ss-tproxy is exist..." -if [ $(systemctl is-enabled ss-tproxy) == "enabled" ]; then - echo "Starting ss-tproxy service..." - systemctl start ss-tproxy +echo "Checking the status of the ss-tproxy service ..." +if systemctl is-active --quiet ss-tproxy.service; then + echo "Restarting ss-tproxy service ..." + systemctl try-restart ss-tproxy.service +elif systemctl is-enabled --quiet ss-tproxy.service; then + echo "Starting ss-tproxy service ..." + systemctl start ss-tproxy.service || true else - echo "The ss-tproxy is not exist." + echo "Skipping ss-tproxy service ..." fi diff --git a/app-proxy/ss-tproxy/autobuild/prerm b/app-proxy/ss-tproxy/autobuild/prerm deleted file mode 100644 index 838fcc194864..000000000000 --- a/app-proxy/ss-tproxy/autobuild/prerm +++ /dev/null @@ -1,7 +0,0 @@ -echo "Check whether ss-tproxy service is running..." -if [ $(systemctl is-active ss-tproxy) == "active" ]; then - echo "Stopping ss-tproxy service..." - systemctl stop ss-tproxy -else - echo "The ss-tproxy service is not running." -fi diff --git a/app-proxy/ss-tproxy/spec b/app-proxy/ss-tproxy/spec index c046f0c3100c..d18fe44eb1fa 100644 --- a/app-proxy/ss-tproxy/spec +++ b/app-proxy/ss-tproxy/spec @@ -1,4 +1,5 @@ VER=4.8.3 -SRCS="https://github.com/zfl9/ss-tproxy/archive/v${VER}.tar.gz" -CHKSUMS="sha256::2ff227546029f8fe06cc71b224158f029105edc4d0aa52c8236754a1b7c19bb6" +REL=1 +SRCS="git::commit=tags/v$VER::https://github.com/zfl9/ss-tproxy.git" +CHKSUMS="SKIP" CHKUPDATE="anitya::id=230996"