From 5d7c0ce3cdda62d50113aae3397e1842e0ce0ad8 Mon Sep 17 00:00:00 2001 From: Gianluca Boiano Date: Fri, 29 May 2026 12:18:43 +0200 Subject: [PATCH] fix(pkgbuild): enable service on upgrade to recreate WantedBy symlink The postinst scriptlets only ran 'systemctl enable' on fresh install, so nodes upgraded across the PR #96 [Install] target change (carbonio-appserver.target -> service-discover.target) never got the new WantedBy symlink under service-discover.target.wants/. The target then failed to pull the service at boot (CO-3797). Enable on upgrade too (yum: $1 -ge 1; apt: drop -z $2 guard) so the symlink is always reconciled against the current unit. --- build/agent/PKGBUILD | 8 ++++++-- build/server/PKGBUILD | 8 ++++++-- release.config.mjs | 2 +- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/build/agent/PKGBUILD b/build/agent/PKGBUILD index 011386b..e0c477e 100644 --- a/build/agent/PKGBUILD +++ b/build/agent/PKGBUILD @@ -80,7 +80,9 @@ package__ubuntu_noble() { postinst__apt() { if [ -d /run/systemd/system ]; then systemctl daemon-reload &>/dev/null || : - if [ "$1" = "configure" ] && [ -z "$2" ]; then + # Enable on both fresh install and upgrade so the [Install] WantedBy= + # symlink is always reconciled against the current unit (self-healing). + if [ "$1" = "configure" ]; then systemctl enable service-discover.service &>/dev/null || : fi fi @@ -91,7 +93,9 @@ postinst__apt() { postinst__yum() { if [ -d /run/systemd/system ]; then systemctl daemon-reload &>/dev/null || : - if [ $1 -eq 1 ]; then + # Enable on both fresh install ($1 -eq 1) and upgrade ($1 -eq 2) so the + # [Install] WantedBy= symlink is always reconciled (self-healing). + if [ $1 -ge 1 ]; then systemctl enable service-discover.service &>/dev/null || : fi fi diff --git a/build/server/PKGBUILD b/build/server/PKGBUILD index d48a466..7f750ce 100644 --- a/build/server/PKGBUILD +++ b/build/server/PKGBUILD @@ -79,7 +79,9 @@ package__ubuntu_noble() { postinst__apt() { if [ -d /run/systemd/system ]; then systemctl daemon-reload &>/dev/null || : - if [ "$1" = "configure" ] && [ -z "$2" ]; then + # Enable on both fresh install and upgrade so the [Install] WantedBy= + # symlink is always reconciled against the current unit (self-healing). + if [ "$1" = "configure" ]; then systemctl enable service-discover.service &>/dev/null || : fi fi @@ -90,7 +92,9 @@ postinst__apt() { postinst__yum() { if [ -d /run/systemd/system ]; then systemctl daemon-reload &>/dev/null || : - if [ $1 -eq 1 ]; then + # Enable on both fresh install ($1 -eq 1) and upgrade ($1 -eq 2) so the + # [Install] WantedBy= symlink is always reconciled (self-healing). + if [ $1 -ge 1 ]; then systemctl enable service-discover.service &>/dev/null || : fi fi diff --git a/release.config.mjs b/release.config.mjs index af966bb..6559869 100644 --- a/release.config.mjs +++ b/release.config.mjs @@ -8,7 +8,7 @@ * @type {import('semantic-release').GlobalConfig} */ export default { - branches: ['devel'], + branches: ['main'], tagFormat: "${version}", plugins: [ [