[pbs-devel] [PATCH proxmox-mail-forward 3/3] d/postinst: register binary in .forward

Fiona Ebner f.ebner at proxmox.com
Fri Oct 21 15:02:47 CEST 2022


Similar to how it is done for pve-manager in PVE. If pvemailforward is
detected, nothing is done. An adapted pve-manager will cleanly handle
the switchover for PVE installations.

Signed-off-by: Fiona Ebner <f.ebner at proxmox.com>
---
 debian/proxmox-mail-forward.postinst | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
 create mode 100755 debian/proxmox-mail-forward.postinst

diff --git a/debian/proxmox-mail-forward.postinst b/debian/proxmox-mail-forward.postinst
new file mode 100755
index 0000000..1c81eea
--- /dev/null
+++ b/debian/proxmox-mail-forward.postinst
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+set -e
+
+case "$1" in
+    configure)
+        # pve-manager is responsible for switching over, so skip when detecting pvemailforward
+        if ! test -f /root/.forward || ! grep -E -q '\|/usr/bin/(proxmox-mail-|pvemail)forward' /root/.forward; then
+            echo '|/usr/bin/proxmox-mail-forward' >>/root/.forward
+        fi
+    ;;
+
+    abort-upgrade|abort-remove|abort-deconfigure|triggered)
+    ;;
+
+    *)
+        echo "postinst called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+exit 0
-- 
2.30.2






More information about the pbs-devel mailing list