]>
Commit | Line | Data |
---|---|---|
7c410d63 | 1 | #!/usr/bin/perl |
2c3a6c0a DM |
2 | |
3 | use strict; | |
7c410d63 | 4 | use warnings; |
2c3a6c0a | 5 | |
09281ad7 | 6 | use PVE::CLI::pveum; |
2c3a6c0a | 7 | |
2c3a6c0a DM |
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 | ||
09281ad7 DM |
21 | my $prepare = sub { |
22 | # autmatically generate the private key if it does not already exists | |
a8a4cd64 | 23 | PVE::Cluster::gen_auth_key(); |
09281ad7 | 24 | }; |
362fe4c6 | 25 | |
09281ad7 | 26 | PVE::CLI::pveum->run_cli($read_password, undef, $prepare); |