public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH manager/proxmox-mail-forward v2 0/2] install proxmox-mail-forward at /usr/libexec
@ 2025-07-16  7:37 Lukas Wagner
  2025-07-16  7:37 ` [pve-devel] [PATCH manager v2 1/1] d/postinst: remove old pvemailforward migration logic Lukas Wagner
  2025-07-16  7:37 ` [pve-devel] [PATCH proxmox-mail-forward v2 1/1] install to /usr/libexec instead of /usr/bin Lukas Wagner
  0 siblings, 2 replies; 5+ messages in thread
From: Lukas Wagner @ 2025-07-16  7:37 UTC (permalink / raw)
  To: pve-devel

proxmox-mail-forward is not intended to be called by regular users, so
installing it at /usr/libexec/proxmox-mail-forward is a better fit.

Changes since v1:
  - Add Fabian's R-b
  - Shorten comment in d/postinst as suggested by Fabian

pve-manager:

Lukas Wagner (1):
  d/postinst: remove old pvemailforward migration logic

 debian/postinst | 10 ----------
 1 file changed, 10 deletions(-)


proxmox-mail-forward:

Lukas Wagner (1):
  install to /usr/libexec instead of /usr/bin

 Makefile                             |  2 --
 debian/lintian-overrides             |  2 +-
 debian/proxmox-mail-forward.postinst | 10 +++++++---
 debian/rules                         |  9 ++++++++-
 4 files changed, 16 insertions(+), 7 deletions(-)


Summary over all repositories:
  5 files changed, 16 insertions(+), 17 deletions(-)

-- 
Generated by murpp 0.9.0


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [pve-devel] [PATCH manager v2 1/1] d/postinst: remove old pvemailforward migration logic
  2025-07-16  7:37 [pve-devel] [PATCH manager/proxmox-mail-forward v2 0/2] install proxmox-mail-forward at /usr/libexec Lukas Wagner
@ 2025-07-16  7:37 ` Lukas Wagner
  2025-07-16 14:36   ` [pve-devel] applied: " Thomas Lamprecht
  2025-07-16  7:37 ` [pve-devel] [PATCH proxmox-mail-forward v2 1/1] install to /usr/libexec instead of /usr/bin Lukas Wagner
  1 sibling, 1 reply; 5+ messages in thread
From: Lukas Wagner @ 2025-07-16  7:37 UTC (permalink / raw)
  To: pve-devel

Before the separate proxmox-mail-forward helper was split out into its
own package, pve-manager shipped its own pvemailforward script. Arguably
this is the reason why the code for migrating the path to the helper in
/root/.forward is part of pve-manager's d/postinst script, not
proxmox-mail-forward's.

The pvemailforward -> proxmox-mail-forward migration happened in
pve-manager 7.2-12. Since we don't support skipping major versions (e.g.
7 -> 9), we should be able to drop the migration code for PVE 9.

This also means that proxmox-mail-forward is now fully in charge of the
contents of /root/.forward.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
Reviewed-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
 debian/postinst | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/debian/postinst b/debian/postinst
index aba39904..6b706951 100755
--- a/debian/postinst
+++ b/debian/postinst
@@ -155,16 +155,6 @@ case "$1" in
         pveam update || true
     fi
 
-    # 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
 
     # same as dh_systemd_enable (code copied)
-- 
2.39.5



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [pve-devel] [PATCH proxmox-mail-forward v2 1/1] install to /usr/libexec instead of /usr/bin
  2025-07-16  7:37 [pve-devel] [PATCH manager/proxmox-mail-forward v2 0/2] install proxmox-mail-forward at /usr/libexec Lukas Wagner
  2025-07-16  7:37 ` [pve-devel] [PATCH manager v2 1/1] d/postinst: remove old pvemailforward migration logic Lukas Wagner
@ 2025-07-16  7:37 ` Lukas Wagner
  2025-07-16 14:36   ` [pve-devel] applied: " Thomas Lamprecht
  1 sibling, 1 reply; 5+ messages in thread
From: Lukas Wagner @ 2025-07-16  7:37 UTC (permalink / raw)
  To: pve-devel

/usr/libexec is intended for binaries which are not intended to be
called by users manually. proxmox-mail-forwarded is only ever supposed
to be called by Postfix via the forwarding mechanism in /root/.forward,
so the binary should be located in /usr/libexec.

The postinst script will automatically migrate the contents of
/root/.forward if needed.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
Reviewed-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---

Notes:
    Changes since v1:
      - Only shortened a comment, as suggested by Fabian

 Makefile                             |  2 --
 debian/lintian-overrides             |  2 +-
 debian/proxmox-mail-forward.postinst | 10 +++++++---
 debian/rules                         |  9 ++++++++-
 4 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/Makefile b/Makefile
index 719a865..8b0f728 100644
--- a/Makefile
+++ b/Makefile
@@ -53,9 +53,7 @@ cargo-build:
 	    --bin proxmox-mail-forward
 
 install: cargo-build
-	install -dm755 $(DESTDIR)/usr/bin
 	$(CARGO) install
-	chmod u+s $(DESTDIR)/usr/bin/$(PACKAGE)
 
 .PHONY: upload
 upload: $(DEBS)
diff --git a/debian/lintian-overrides b/debian/lintian-overrides
index bde570e..e8955c1 100644
--- a/debian/lintian-overrides
+++ b/debian/lintian-overrides
@@ -1 +1 @@
-proxmox-mail-forward: elevated-privileges 4755 root/root [usr/bin/proxmox-mail-forward]
+proxmox-mail-forward: elevated-privileges 4755 root/root [usr/libexec/proxmox-mail-forward]
diff --git a/debian/proxmox-mail-forward.postinst b/debian/proxmox-mail-forward.postinst
index c4b8741..f8a61ed 100755
--- a/debian/proxmox-mail-forward.postinst
+++ b/debian/proxmox-mail-forward.postinst
@@ -4,9 +4,13 @@ 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
+        # The entry is rewritten unconditionally
+        if test -f /root/.forward; then
+           sed -i '\!|/usr/bin/proxmox-mail-forward!d' /root/.forward
+        fi
+
+        if ! test -f /root/.forward || ! grep -q '|/usr/libexec/proxmox-mail-forward' /root/.forward; then
+            echo '|/usr/libexec/proxmox-mail-forward' >>/root/.forward
         fi
     ;;
 
diff --git a/debian/rules b/debian/rules
index c9fa5cd..cc2ec17 100755
--- a/debian/rules
+++ b/debian/rules
@@ -25,9 +25,16 @@ override_dh_auto_configure:
 	$(CARGO) prepare-debian $(CURDIR)/debian/cargo_registry --link-from-system
 	dh_auto_configure
 
+execute_after_dh_auto_install:
+	# Install the binary to /usr/libexec, not /usr/bin. Inspired by virtiofsd's d/rules
+	mkdir -p debian/proxmox-mail-forward/usr/libexec
+	mv debian/proxmox-mail-forward/usr/bin/proxmox-mail-forward debian/proxmox-mail-forward/usr/libexec/
+	chmod u+s debian/proxmox-mail-forward/usr/libexec/proxmox-mail-forward
+	rmdir debian/proxmox-mail-forward/usr/bin
+
 override_dh_fixperms:
 	dh_fixperms --exclude proxmox-mail-forward
 
 override_dh_strip:
 	dh_strip
-	patchelf --remove-needed librt.so.1 debian/proxmox-mail-forward/usr/bin/proxmox-mail-forward
+	patchelf --remove-needed librt.so.1 debian/proxmox-mail-forward/usr/libexec/proxmox-mail-forward
-- 
2.39.5



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [pve-devel] applied: [PATCH manager v2 1/1] d/postinst: remove old pvemailforward migration logic
  2025-07-16  7:37 ` [pve-devel] [PATCH manager v2 1/1] d/postinst: remove old pvemailforward migration logic Lukas Wagner
@ 2025-07-16 14:36   ` Thomas Lamprecht
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas Lamprecht @ 2025-07-16 14:36 UTC (permalink / raw)
  To: pve-devel, Lukas Wagner

On Wed, 16 Jul 2025 09:37:58 +0200, Lukas Wagner wrote:
> Before the separate proxmox-mail-forward helper was split out into its
> own package, pve-manager shipped its own pvemailforward script. Arguably
> this is the reason why the code for migrating the path to the helper in
> /root/.forward is part of pve-manager's d/postinst script, not
> proxmox-mail-forward's.
> 
> The pvemailforward -> proxmox-mail-forward migration happened in
> pve-manager 7.2-12. Since we don't support skipping major versions (e.g.
> 7 -> 9), we should be able to drop the migration code for PVE 9.
> 
> [...]

Applied, thanks!

[1/1] d/postinst: remove old pvemailforward migration logic
      (no commit info)


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [pve-devel] applied: [PATCH proxmox-mail-forward v2 1/1] install to /usr/libexec instead of /usr/bin
  2025-07-16  7:37 ` [pve-devel] [PATCH proxmox-mail-forward v2 1/1] install to /usr/libexec instead of /usr/bin Lukas Wagner
@ 2025-07-16 14:36   ` Thomas Lamprecht
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas Lamprecht @ 2025-07-16 14:36 UTC (permalink / raw)
  To: pve-devel, Lukas Wagner

On Wed, 16 Jul 2025 09:37:59 +0200, Lukas Wagner wrote:
> /usr/libexec is intended for binaries which are not intended to be
> called by users manually. proxmox-mail-forwarded is only ever supposed
> to be called by Postfix via the forwarding mechanism in /root/.forward,
> so the binary should be located in /usr/libexec.
> 
> The postinst script will automatically migrate the contents of
> /root/.forward if needed.
> 
> [...]

Applied, thanks!

[1/1] install to /usr/libexec instead of /usr/bin
      commit: 40eb7cf9d241466911e3f5bdff8717b7e2d1705f


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-07-16 14:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-07-16  7:37 [pve-devel] [PATCH manager/proxmox-mail-forward v2 0/2] install proxmox-mail-forward at /usr/libexec Lukas Wagner
2025-07-16  7:37 ` [pve-devel] [PATCH manager v2 1/1] d/postinst: remove old pvemailforward migration logic Lukas Wagner
2025-07-16 14:36   ` [pve-devel] applied: " Thomas Lamprecht
2025-07-16  7:37 ` [pve-devel] [PATCH proxmox-mail-forward v2 1/1] install to /usr/libexec instead of /usr/bin Lukas Wagner
2025-07-16 14:36   ` [pve-devel] applied: " Thomas Lamprecht

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