all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Stefan Hanreich <s.hanreich@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH pve-manager 1/1] network-interface-pinning: move to libexec and rename
Date: Wed, 30 Jul 2025 16:16:05 +0200	[thread overview]
Message-ID: <20250730141610.282177-1-s.hanreich@proxmox.com> (raw)

In order to avoid conflicts and confusion with the standalone
proxmox-network-interface-pinning standalone tool, rename to
pve-network-interface-pinning. Addtionally, install to the
/usr/libexec/proxmox directory, which is now our preferred location
for shipping custom scripts / CLI tools.

The standalone tool will check for the existence of
pve-network-interface-pinning and invoke the PVE specific script if it
is installed on the host. This makes it possible for the tool to
properly run on hosts where PVE and PBS are both installed.

Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
---
 PVE/CLI/Makefile                              |  2 +-
 ...ng.pm => pve_network_interface_pinning.pm} | 10 +++---
 bin/Makefile                                  | 35 ++++++++++++-------
 bin/proxmox-network-interface-pinning         |  8 -----
 bin/pve-network-interface-pinning             |  8 +++++
 defines.mk                                    |  1 +
 6 files changed, 37 insertions(+), 27 deletions(-)
 rename PVE/CLI/{proxmox_network_interface_pinning.pm => pve_network_interface_pinning.pm} (97%)
 delete mode 100644 bin/proxmox-network-interface-pinning
 create mode 100644 bin/pve-network-interface-pinning

diff --git a/PVE/CLI/Makefile b/PVE/CLI/Makefile
index f85047d37..922ba9458 100644
--- a/PVE/CLI/Makefile
+++ b/PVE/CLI/Makefile
@@ -10,7 +10,7 @@ SOURCES = \
 	pvesh.pm \
 	pve7to8.pm \
 	pve8to9.pm \
-	proxmox_network_interface_pinning.pm \
+	pve_network_interface_pinning.pm \
 
 all:
 
diff --git a/PVE/CLI/proxmox_network_interface_pinning.pm b/PVE/CLI/pve_network_interface_pinning.pm
similarity index 97%
rename from PVE/CLI/proxmox_network_interface_pinning.pm
rename to PVE/CLI/pve_network_interface_pinning.pm
index adc0acd52..6cee2a4ae 100644
--- a/PVE/CLI/proxmox_network_interface_pinning.pm
+++ b/PVE/CLI/pve_network_interface_pinning.pm
@@ -1,4 +1,4 @@
-package PVE::CLI::proxmox_network_interface_pinning;
+package PVE::CLI::pve_network_interface_pinning;
 
 use v5.36;
 
@@ -245,8 +245,8 @@ my sub generate_link_files {
     }
 }
 
-package PVE::CLI::proxmox_network_interface_pinning::InterfaceMapping {
-    use PVE::CLI::proxmox_network_interface_pinning;
+package PVE::CLI::pve_network_interface_pinning::InterfaceMapping {
+    use PVE::CLI::pve_network_interface_pinning;
     use PVE::Tools;
 
     sub new {
@@ -428,12 +428,12 @@ __PACKAGE__->register_method({
                 die "target-name already exists as link or pin!\n"
                     if $ip_links->{$target_name} || grep { $target_name eq $_ } values $pinned->%*;
 
-                $mapping = PVE::CLI::proxmox_network_interface_pinning::InterfaceMapping->new({
+                $mapping = PVE::CLI::pve_network_interface_pinning::InterfaceMapping->new({
                     $iface => $target_name,
                 });
             } else {
                 $mapping =
-                    PVE::CLI::proxmox_network_interface_pinning::InterfaceMapping->generate(
+                    PVE::CLI::pve_network_interface_pinning::InterfaceMapping->generate(
                         $ip_links,
                         $pinned,
                         $prefix,
diff --git a/bin/Makefile b/bin/Makefile
index a8001c2eb..2ce318563 100644
--- a/bin/Makefile
+++ b/bin/Makefile
@@ -14,7 +14,9 @@ CLITOOLS = \
 	pvesh \
 	pve7to8 \
 	pve8to9 \
-	proxmox-network-interface-pinning \
+
+LIBEXECCLITOOLS = \
+	pve-network-interface-pinning \
 
 
 SCRIPTS =  			\
@@ -41,6 +43,7 @@ SERVICE_MANS = $(addsuffix .8, $(SERVICES))
 
 CLI_MANS = 				\
 	$(addsuffix .1, $(CLITOOLS))	\
+	$(addsuffix .1, $(LIBEXECCLITOOLS))	\
 	pveversion.1			\
 	pveupgrade.1			\
 	pveperf.1			\
@@ -49,10 +52,12 @@ CLI_MANS = 				\
 BASH_COMPLETIONS = 						\
 	$(addsuffix .service-bash-completion, $(SERVICES)) 	\
 	$(addsuffix .bash-completion, $(CLITOOLS)) 		\
+	$(addsuffix .bash-completion, $(LIBEXECCLITOOLS)) 		\
 
 ZSH_COMPLETIONS =						\
 	$(addsuffix .service-zsh-completion, $(SERVICES)) 	\
 	$(addsuffix .zsh-completion, $(CLITOOLS))		\
+	$(addsuffix .zsh-completion, $(LIBEXECCLITOOLS))		\
 
 all: $(SERVICE_MANS) $(CLI_MANS)
 
@@ -74,20 +79,20 @@ pve7to8.1:
 	printf ".SH SYNOPSIS\npve7to8 [--full]\n" >> $@.tmp
 	mv $@.tmp $@
 
-proxmox-network-interface-pinning.1:
-	printf "proxmox-network-interface-pinning" > $@.tmp
+pve-network-interface-pinning.1:
+	printf "pve-network-interface-pinning" > $@.tmp
 	mv $@.tmp $@
 
-proxmox-network-interface-pinning.api-verified:
-	perl ${PERL_DOC_INC} -T -e "use PVE::CLI::proxmox_network_interface_pinning; PVE::CLI::proxmox_network_interface_pinning->verify_api();"
-	touch 'proxmox-network-interface-pinning.service-api-verified'
+pve-network-interface-pinning.api-verified:
+	perl ${PERL_DOC_INC} -T -e "use PVE::CLI::pve_network_interface_pinning; PVE::CLI::pve_network_interface_pinning->verify_api();"
+	touch 'pve-network-interface-pinning.service-api-verified'
 
-proxmox-network-interface-pinning.zsh-completion:
-	perl ${PERL_DOC_INC} -T -e "use PVE::CLI::proxmox_network_interface_pinning; PVE::CLI::proxmox_network_interface_pinning->generate_zsh_completions();" >$@.tmp
+pve-network-interface-pinning.zsh-completion:
+	perl ${PERL_DOC_INC} -T -e "use PVE::CLI::pve_network_interface_pinning; PVE::CLI::pve_network_interface_pinning->generate_zsh_completions();" >$@.tmp
 	mv $@.tmp $@
 
-proxmox-network-interface-pinning.bash-completion:
-	perl ${PERL_DOC_INC} -T -e "use PVE::CLI::proxmox_network_interface_pinning; PVE::CLI::proxmox_network_interface_pinning->generate_bash_completions();" >$@.tmp
+pve-network-interface-pinning.bash-completion:
+	perl ${PERL_DOC_INC} -T -e "use PVE::CLI::pve_network_interface_pinning; PVE::CLI::pve_network_interface_pinning->generate_bash_completions();" >$@.tmp
 	mv $@.tmp $@
 
 pve8to9.1:
@@ -106,16 +111,18 @@ pvereport.1.pod: pvereport
 
 .PHONY: tidy
 tidy:
-	echo $(SCRIPTS) $(HELPERS) $(MIGRATIONS) | xargs -n4 -P0 proxmox-perltidy
+	echo $(SCRIPTS) $(HELPERS) $(MIGRATIONS) $(LIBEXECCLITOOLS) | xargs -n4 -P0 proxmox-perltidy
 
 .PHONY: check
-check: $(addsuffix .service-api-verified, $(SERVICES)) $(addsuffix .api-verified, $(CLITOOLS))
+check: $(addsuffix .service-api-verified, $(SERVICES)) $(addsuffix .api-verified, $(CLITOOLS)) $(addsuffix .api-verified, $(LIBEXECCLITOOLS))
 	rm -f *.service-api-verified *.api-verified
 
 .PHONY: install
-install: $(SCRIPTS) $(CLI_MANS) $(SERVICE_MANS) $(BASH_COMPLETIONS) $(ZSH_COMPLETIONS)
+install: $(SCRIPTS) $(LIBEXECCLITOOLS) $(CLI_MANS) $(SERVICE_MANS) $(BASH_COMPLETIONS) $(ZSH_COMPLETIONS)
 	install -d $(BINDIR)
 	install -m 0755 $(SCRIPTS) $(BINDIR)
+	install -d $(LIBEXECDIR)
+	install -m 0755 $(LIBEXECCLITOOLS) $(LIBEXECDIR)
 	install -d $(USRSHARE)/helpers
 	install -m 0755 $(HELPERS) $(USRSHARE)/helpers
 	install -d $(USRSHARE)/migrations
@@ -125,8 +132,10 @@ install: $(SCRIPTS) $(CLI_MANS) $(SERVICE_MANS) $(BASH_COMPLETIONS) $(ZSH_COMPLE
 	install -d $(MAN8DIR)
 	install -m 0644 $(SERVICE_MANS) $(MAN8DIR)
 	for i in $(CLITOOLS); do install -m 0644 -D $$i.bash-completion $(BASHCOMPLDIR)/$$i; done
+	for i in $(LIBEXECCLITOOLS); do install -m 0644 -D $$i.bash-completion $(BASHCOMPLDIR)/$$i; done
 	for i in $(SERVICES); do install -m 0644 -D $$i.service-bash-completion $(BASHCOMPLDIR)/$$i; done
 	for i in $(CLITOOLS); do install -m 0644 -D $$i.zsh-completion $(ZSHCOMPLDIR)/_$$i; done
+	for i in $(LIBEXECCLITOOLS); do install -m 0644 -D $$i.zsh-completion $(ZSHCOMPLDIR)/_$$i; done
 	for i in $(SERVICES); do install -m 0644 -D $$i.service-zsh-completion $(ZSHCOMPLDIR)/_$$i; done
 
 .PHONY: clean
diff --git a/bin/proxmox-network-interface-pinning b/bin/proxmox-network-interface-pinning
deleted file mode 100644
index b6922fb46..000000000
--- a/bin/proxmox-network-interface-pinning
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/usr/bin/perl
-
-use strict;
-use warnings;
-
-use PVE::CLI::proxmox_network_interface_pinning;
-
-PVE::CLI::proxmox_network_interface_pinning->run_cli_handler();
diff --git a/bin/pve-network-interface-pinning b/bin/pve-network-interface-pinning
new file mode 100644
index 000000000..7614f88b2
--- /dev/null
+++ b/bin/pve-network-interface-pinning
@@ -0,0 +1,8 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use PVE::CLI::pve_network_interface_pinning;
+
+PVE::CLI::pve_network_interface_pinning->run_cli_handler();
diff --git a/defines.mk b/defines.mk
index 7c3c060e4..66704d521 100644
--- a/defines.mk
+++ b/defines.mk
@@ -1,6 +1,7 @@
 PACKAGE=pve-manager
 
 BINDIR=$(DESTDIR)/usr/bin
+LIBEXECDIR=$(DESTDIR)/usr/libexec/proxmox
 PERLLIBDIR=$(DESTDIR)/usr/share/perl5
 MAN1DIR=$(DESTDIR)/usr/share/man/man1
 MAN8DIR=$(DESTDIR)/usr/share/man/man8
-- 
2.47.2


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


             reply	other threads:[~2025-07-30 14:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-30 14:16 Stefan Hanreich [this message]
2025-08-05  9:43 ` [pve-devel] applied: " 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=20250730141610.282177-1-s.hanreich@proxmox.com \
    --to=s.hanreich@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