[pve-devel] [PATCH manager 2/4] d/postinst: replace pvemailforward with proxmox-mail-forward

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


proxmox-mail-forward is a new helper binary in Rust intended to behave
essentially the same on PVE installations. It can also handle mixed
PBS+PVE installations.

Signed-off-by: Fiona Ebner <f.ebner at proxmox.com>
---
The downside with this approach is that a downgrade of
pve-manager will re-introduce the pvemailforward entry in .forward,
which means duplicate mails (except proxmox-mail-forward is removed
again at the same time).

An alternative would be using a Breaks on pve-manager:
1. don't touch .forward in pve-manager's postinst anymore
2. have proxmox-mail-forward break older pve-manager
3. have proxmox-mail-forward's postinst replace the entry in .forward

 debian/postinst | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/debian/postinst b/debian/postinst
index 7980ef98..d8ee170d 100755
--- a/debian/postinst
+++ b/debian/postinst
@@ -126,8 +126,14 @@ case "$1" in
         pveam update || true
     fi
 
-    if ! test -f /root/.forward || ! grep -q '|/usr/bin/pvemailforward' /root/.forward; then
-        echo '|/usr/bin/pvemailforward' >>/root/.forward
+    # Always try to clean old entry, even when proxmox-mail-forward entry is already present.
+    # This ensures it will still be cleaned after an upgrade following a downgrade.
+    if test -f /root/.forward; then
+        sed -i '\!|/usr/bin/pvemailforward!d' /root/.forward
+    fi
+
+    if ! test -f /root/.forward || ! grep -q '|/usr/bin/proxmox-mail-forward' /root/.forward; then
+        echo '|/usr/bin/proxmox-mail-forward' >>/root/.forward
     fi
 
     systemctl --system daemon-reload >/dev/null || true
-- 
2.30.2






More information about the pve-devel mailing list