]> git.proxmox.com Git - pve-access-control.git/blob - pveum
convert pveum into a PVE::CLI class
[pve-access-control.git] / pveum
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5
6 use PVE::CLI::pveum;
7
8 my $read_password = sub {
9
10 # return $ENV{PVE_PW_TICKET} if defined($ENV{PVE_PW_TICKET});
11
12 my $term = new Term::ReadLine ('pveum');
13 my $attribs = $term->Attribs;
14 $attribs->{redisplay_function} = $attribs->{shadow_redisplay};
15 my $input = $term->readline('Enter new password: ');
16 my $conf = $term->readline('Retype new password: ');
17 die "Passwords do not match.\n" if ($input ne $conf);
18 return $input;
19 };
20
21 my $prepare = sub {
22 # autmatically generate the private key if it does not already exists
23 PVE::Cluster::gen_auth_key();
24 };
25
26 PVE::CLI::pveum->run_cli($read_password, undef, $prepare);