all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Lukas Wagner <l.wagner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH proxmox-mail-forward v2 1/1] install to /usr/libexec instead of /usr/bin
Date: Wed, 16 Jul 2025 09:37:59 +0200	[thread overview]
Message-ID: <20250716073759.40752-3-l.wagner@proxmox.com> (raw)
In-Reply-To: <20250716073759.40752-1-l.wagner@proxmox.com>

/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

  parent reply	other threads:[~2025-07-16  7:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Lukas Wagner [this message]
2025-07-16 14:36   ` [pve-devel] applied: [PATCH proxmox-mail-forward v2 1/1] install to /usr/libexec instead of /usr/bin Thomas Lamprecht

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=20250716073759.40752-3-l.wagner@proxmox.com \
    --to=l.wagner@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal