From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <pve-devel-bounces@lists.proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9])
	by lore.proxmox.com (Postfix) with ESMTPS id 7CA6D1FF168
	for <inbox@lore.proxmox.com>; Tue, 18 Feb 2025 14:32:15 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
	by firstgate.proxmox.com (Proxmox) with ESMTP id 66CA6D22B;
	Tue, 18 Feb 2025 14:32:10 +0100 (CET)
From: Maximiliano Sandoval <m.sandoval@proxmox.com>
To: pve-devel@lists.proxmox.com
Date: Tue, 18 Feb 2025 14:32:05 +0100
Message-Id: <20250218133206.318155-1-m.sandoval@proxmox.com>
X-Mailer: git-send-email 2.39.5
MIME-Version: 1.0
X-SPAM-LEVEL: Spam detection results:  0
 AWL 0.102 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DMARC_MISSING             0.1 Missing DMARC policy
 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
 URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See
 http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more
 information. [qemuserver.pm, linuxfoundation.org]
Subject: [pve-devel] [PATCH qemu-server v2 1/2] vm-network-scripts: move
 scripts to /usr/libexec
X-BeenThere: pve-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/>
List-Post: <mailto:pve-devel@lists.proxmox.com>
List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe>
Reply-To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: pve-devel-bounces@lists.proxmox.com
Sender: "pve-devel" <pve-devel-bounces@lists.proxmox.com>

Moves the network scripts from /var/lib/qemu-server into
/usr/libexec/qemu-server.

/usr/libexec is described as binaries run by programs which are not
intended to be directly executed by the user on [FHS 4.7]. On the other
hand /var/lib corresponds to variable state information, which does not
fit the use case here, see [FHS 5.8].

For the sake of preventing race conditions we ship both versions until
version 9.

[FHS 4.7]: https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch04s07.html
[FHS 5.8]: https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch05s08.html

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---

Differences from v1:
 - Ship both versions until v9 to prevent race conditions.
 - Rebase

 PVE/QemuServer.pm                     | 4 ++--
 vm-network-scripts/Makefile           | 6 ++++++
 vm-network-scripts/pve-bridge-hotplug | 2 +-
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 808c0e1c..46b588b7 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -1674,8 +1674,8 @@ sub print_netdev_full {
     my $script = $hotplug ? "pve-bridge-hotplug" : "pve-bridge";
 
     if ($net->{bridge}) {
-	$netdev = "type=tap,id=$netid,ifname=${ifname},script=/var/lib/qemu-server/$script"
-	    .",downscript=/var/lib/qemu-server/pve-bridgedown$vhostparam";
+	$netdev = "type=tap,id=$netid,ifname=${ifname},script=/usr/libexec/qemu-server/$script"
+	    .",downscript=/usr/libexec/qemu-server/pve-bridgedown$vhostparam";
     } else {
         $netdev = "type=user,id=$netid,hostname=$vmname";
     }
diff --git a/vm-network-scripts/Makefile b/vm-network-scripts/Makefile
index 5ba537d0..61733e2d 100644
--- a/vm-network-scripts/Makefile
+++ b/vm-network-scripts/Makefile
@@ -1,8 +1,14 @@
 DESTDIR=
+LIBEXECDIR=$(DESTDIR)/usr/libexec/qemu-server
+# Remove with version 9
 VARLIBDIR=$(DESTDIR)/var/lib/qemu-server
 
 .PHONY: install
 install: pve-bridge pve-bridge-hotplug pve-bridgedown
+	install -d ${LIBEXECDIR}
+	install -m 0755 pve-bridge ${LIBEXECDIR}/pve-bridge
+	install -m 0755 pve-bridge-hotplug ${LIBEXECDIR}/pve-bridge-hotplug
+	install -m 0755 pve-bridgedown ${LIBEXECDIR}/pve-bridgedown
 	install -d ${VARLIBDIR}
 	install -m 0755 pve-bridge ${VARLIBDIR}/pve-bridge
 	install -m 0755 pve-bridge-hotplug ${VARLIBDIR}/pve-bridge-hotplug
diff --git a/vm-network-scripts/pve-bridge-hotplug b/vm-network-scripts/pve-bridge-hotplug
index f36ed408..3ae01ea5 100755
--- a/vm-network-scripts/pve-bridge-hotplug
+++ b/vm-network-scripts/pve-bridge-hotplug
@@ -1,3 +1,3 @@
 #!/bin/sh
 
-exec /var/lib/qemu-server/pve-bridge --hotplug "$@"
+exec /usr/libexec/qemu-server/pve-bridge --hotplug "$@"
-- 
2.39.5



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