From 366f384b7483902b4dc6ecd7b376ef7b61f2ea9e Mon Sep 17 00:00:00 2001
From: Louis Maillard <louis.maillard@savoirfairelinux.com>
Date: Tue, 23 Jul 2024 14:35:03 -0400
Subject: [PATCH] postrm: add script to clean systemd on uninstall

This script stops and disables the dnc.service unit file and removes it.
It's a fix for an issue where, on upgrade or uninstall+install, the
service file became 'masked' and linked to /dev/null.

Change-Id: Ifcc6bc42212e0241c775cdd24df5f937780e0a9b
---
 extras/packaging/gnu-linux/debian/postrm | 7 +++++++
 1 file changed, 7 insertions(+)
 create mode 100644 extras/packaging/gnu-linux/debian/postrm

diff --git a/extras/packaging/gnu-linux/debian/postrm b/extras/packaging/gnu-linux/debian/postrm
new file mode 100644
index 0000000..e944ce8
--- /dev/null
+++ b/extras/packaging/gnu-linux/debian/postrm
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+(test -x /usr/bin/systemctl && systemctl stop dnc.service && systemctl disable dnc.service && echo "stopped dnc.service") || true
+
+(test -e /etc/systemd/system/dnc.service && rm -f /etc/systemd/system/dnc.service) || true
+
+exit 0
-- 
GitLab