From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id A2B378ACA0; Fri, 21 Oct 2022 15:03:00 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 1E5CF2235E; Fri, 21 Oct 2022 15:03:00 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS; Fri, 21 Oct 2022 15:02:58 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 69B4744B1B; Fri, 21 Oct 2022 15:02:57 +0200 (CEST) From: Fiona Ebner To: pve-devel@lists.proxmox.com, pbs-devel@lists.proxmox.com Date: Fri, 21 Oct 2022 15:02:50 +0200 Message-Id: <20221021130252.176316-8-f.ebner@proxmox.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221021130252.176316-1-f.ebner@proxmox.com> References: <20221021130252.176316-1-f.ebner@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.028 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH manager 2/4] d/postinst: replace pvemailforward with proxmox-mail-forward X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2022 13:03:00 -0000 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 --- 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