commit 79c958ea90aee07d78b72ff7c15b2107f3df4700
parent 7f02630773be1c122c5b1f252a032ce965524802
Author: bohdan-potuzhnyi <bohdan.potuzhnyi@gmail.com>
Date: Mon, 14 Apr 2025 14:24:07 +0200
changing the .install and .prerm for proper upgrade procedure
Diffstat:
2 files changed, 29 insertions(+), 0 deletions(-)
diff --git a/debian/taler-merchant.postinst b/debian/taler-merchant.postinst
@@ -2,6 +2,8 @@
set -e
+MARKER="/run/taler/merchant.was-enabled"
+
if [ -d /run/systemd/system ]; then
systemctl --system daemon-reload >/dev/null || true
fi
@@ -59,6 +61,21 @@ configure)
taler-merchant-httpd root 460 \
/etc/taler-merchant/secrets/merchant-db.secret.conf
fi
+
+ if [ -f "$MARKER" ] && grep -q "enabled" "$MARKER"; then
+ echo "taler-merchant-httpd was previously enabled, running DB config."
+
+ if [ -x /usr/local/bin/taler-merchant-dbconfig ]; then
+ /usr/local/bin/taler-merchant-dbconfig || true
+ fi
+
+ systemctl start taler-merchant.target || true
+ else
+ echo "Not enabling or starting Taler merchant services (marker not found or was 'disabled')."
+ fi
+
+ # Cleanup marker file
+ rm -f "$MARKER"
;;
abort-upgrade | abort-remove | abort-deconfigure) ;;
diff --git a/debian/taler-merchant.prerm b/debian/taler-merchant.prerm
@@ -2,8 +2,20 @@
set -e
+MARKER="/run/taler/merchant.was-enabled"
+
if [ -d /run/systemd/system ] && [ "$1" = remove ]; then
deb-systemd-invoke stop 'taler-merchant*' >/dev/null || true
fi
+if [ -d /run/systemd/system ] && [ "$1" = upgrade ]; then
+
+ if systemctl is-enabled taler-merchant-httpd.service >/dev/null 2>&1; then
+ echo "taler-merchant-httpd was enabled before upgrade/remove."
+ echo "enabled" > "$MARKER"
+ fi
+
+ deb-systemd-invoke stop 'taler-merchant*' >/dev/null || true
+fi
+
exit 0