network-interface-pinning: move to libexec and rename
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> Link: https://lore.proxmox.com/20250730141610.282177-1-s.hanreich@proxmox.com
This commit is contained in:
parent
40bbbd26f6
commit
a777811227
6 changed files with 40 additions and 27 deletions
|
|
@ -9,7 +9,7 @@ SOURCES = \
|
|||
pvenode.pm \
|
||||
pvesh.pm \
|
||||
pve8to9.pm \
|
||||
proxmox_network_interface_pinning.pm \
|
||||
pve_network_interface_pinning.pm \
|
||||
|
||||
all:
|
||||
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
38
bin/Makefile
38
bin/Makefile
|
|
@ -13,7 +13,9 @@ CLITOOLS = \
|
|||
pvenode \
|
||||
pvesh \
|
||||
pve8to9 \
|
||||
proxmox-network-interface-pinning \
|
||||
|
||||
LIBEXECCLITOOLS = \
|
||||
pve-network-interface-pinning \
|
||||
|
||||
|
||||
SCRIPTS = \
|
||||
|
|
@ -40,6 +42,7 @@ SERVICE_MANS = $(addsuffix .8, $(SERVICES))
|
|||
|
||||
CLI_MANS = \
|
||||
$(addsuffix .1, $(CLITOOLS)) \
|
||||
$(addsuffix .1, $(LIBEXECCLITOOLS)) \
|
||||
pveversion.1 \
|
||||
pveupgrade.1 \
|
||||
pveperf.1 \
|
||||
|
|
@ -48,10 +51,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)
|
||||
|
||||
|
|
@ -64,20 +69,23 @@ all: $(SERVICE_MANS) $(CLI_MANS)
|
|||
podselect $* > $@.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
|
||||
printf ".TH PVE-NETWORK-INTERFACE-PINNING 1\n.SH NAME\npve-network-interface-pinning \- Assisted interface name pinning.\n" > $@.tmp
|
||||
printf ".SH DESCRIPTION\nThis tool helps you to configure a network interface name pinning \
|
||||
and adapting all relevant Proxmox VE config files.\n" >> $@.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:
|
||||
|
|
@ -96,16 +104,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
|
||||
|
|
@ -115,8 +125,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
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
8
bin/pve-network-interface-pinning
Normal file
8
bin/pve-network-interface-pinning
Normal file
|
|
@ -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();
|
||||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue