public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com, pbs-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH manager 2/4] d/postinst: replace pvemailforward with proxmox-mail-forward
Date: Fri, 21 Oct 2022 15:02:50 +0200	[thread overview]
Message-ID: <20221021130252.176316-8-f.ebner@proxmox.com> (raw)
In-Reply-To: <20221021130252.176316-1-f.ebner@proxmox.com>

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@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





  parent reply	other threads:[~2022-10-21 13:03 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-21 13:02 [pve-devel] [PATCH-SERIES proxmox{, -mail-forward, -backup}/pve-manager] add proxmox-mail-forward helper binary Fiona Ebner
2022-10-21 13:02 ` [pve-devel] [PATCH proxmox 1/1] section config: parse additional properties when schema allows it Fiona Ebner
2022-10-24 11:47   ` [pve-devel] applied: " Wolfgang Bumiller
2022-10-21 13:02 ` [pve-devel] [PATCH proxmox-mail-forward 1/3] initial commit Fiona Ebner
2022-11-10 10:46   ` [pve-devel] applied: " Wolfgang Bumiller
2022-10-21 13:02 ` [pve-devel] [PATCH proxmox-mail-forward 2/3] add Debian packaging Fiona Ebner
2022-10-21 13:02 ` [pve-devel] [PATCH proxmox-mail-forward 3/3] d/postinst: register binary in .forward Fiona Ebner
2022-10-21 13:02 ` [pve-devel] [PATCH proxmox-backup 1/1] fix #4287: d/control: recommend proxmox-mail-forward Fiona Ebner
2022-11-10 10:49   ` [pve-devel] applied: " Wolfgang Bumiller
2022-10-21 13:02 ` [pve-devel] [PATCH manager 1/4] d/control: depend on proxmox-mail-forward Fiona Ebner
2022-10-21 13:02 ` Fiona Ebner [this message]
2022-10-21 13:02 ` [pve-devel] [PATCH manager 3/4] remove pvemailforward binary Fiona Ebner
2022-10-21 13:02 ` [pve-devel] [PATCH manager 4/4] d/control: drop ${shlibs:Depends} for pve-manager Fiona Ebner
2022-11-10 11:11   ` Thomas Lamprecht
2022-11-10 10:58 ` [pve-devel] applied-series: [PATCH-SERIES proxmox{, -mail-forward, -backup}/pve-manager] add proxmox-mail-forward helper binary Wolfgang Bumiller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221021130252.176316-8-f.ebner@proxmox.com \
    --to=f.ebner@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal