mirror of
https://git.proxmox.com/git/pve-common
synced 2025-08-14 11:06:15 +00:00
PBSClient: allow running other binaries
...such as proxmox-file-restore. Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
This commit is contained in:
parent
6ab98c4e53
commit
b15abdfe2e
@ -139,8 +139,9 @@ my sub do_raw_client_cmd {
|
|||||||
|
|
||||||
my $use_crypto = $USE_CRYPT_PARAMS->{$client_cmd};
|
my $use_crypto = $USE_CRYPT_PARAMS->{$client_cmd};
|
||||||
|
|
||||||
my $client_exe = '/usr/bin/proxmox-backup-client';
|
my $client_exe = (delete $opts{binary}) || 'proxmox-backup-client';
|
||||||
die "executable not found '$client_exe'! Proxmox backup client not installed?\n"
|
$client_exe = "/usr/bin/$client_exe";
|
||||||
|
die "executable not found '$client_exe'! Proxmox backup client or file restore not installed?\n"
|
||||||
if ! -x $client_exe;
|
if ! -x $client_exe;
|
||||||
|
|
||||||
my $scfg = $self->{scfg};
|
my $scfg = $self->{scfg};
|
||||||
@ -193,22 +194,25 @@ my sub run_raw_client_cmd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
my sub run_client_cmd {
|
my sub run_client_cmd {
|
||||||
my ($self, $client_cmd, $param, $no_output) = @_;
|
my ($self, $client_cmd, $param, $no_output, $binary) = @_;
|
||||||
|
|
||||||
my $json_str = '';
|
my $json_str = '';
|
||||||
my $outfunc = sub { $json_str .= "$_[0]\n" };
|
my $outfunc = sub { $json_str .= "$_[0]\n" };
|
||||||
|
|
||||||
|
$binary //= 'proxmox-backup-client';
|
||||||
|
|
||||||
$param = [] if !defined($param);
|
$param = [] if !defined($param);
|
||||||
$param = [ $param ] if !ref($param);
|
$param = [ $param ] if !ref($param);
|
||||||
|
|
||||||
$param = [@$param, '--output-format=json'] if !$no_output;
|
$param = [@$param, '--output-format=json'] if !$no_output;
|
||||||
|
|
||||||
do_raw_client_cmd(
|
do_raw_client_cmd(
|
||||||
$self,
|
$self,
|
||||||
$client_cmd,
|
$client_cmd,
|
||||||
$param,
|
$param,
|
||||||
outfunc => $outfunc,
|
outfunc => $outfunc,
|
||||||
errmsg => 'proxmox-backup-client failed'
|
errmsg => "$binary failed",
|
||||||
|
binary => $binary,
|
||||||
);
|
);
|
||||||
|
|
||||||
return undef if $no_output;
|
return undef if $no_output;
|
||||||
|
Loading…
Reference in New Issue
Block a user