diff options
author | damien <damien@mandriva.com> | 2001-01-11 15:54:30 +0000 |
---|---|---|
committer | damien <damien@mandriva.com> | 2001-01-11 15:54:30 +0000 |
commit | cac77c66f8f2f72a62c199e90c2a601d34625573 (patch) | |
tree | b2d0624c974a6803c84536990a67a7ff77a1e618 /perl-install/install_steps.pm | |
parent | bc4652f9fd3667e56b71a1d09214c82c175095b2 (diff) | |
download | drakx-cac77c66f8f2f72a62c199e90c2a601d34625573.tar drakx-cac77c66f8f2f72a62c199e90c2a601d34625573.tar.gz drakx-cac77c66f8f2f72a62c199e90c2a601d34625573.tar.bz2 drakx-cac77c66f8f2f72a62c199e90c2a601d34625573.tar.xz drakx-cac77c66f8f2f72a62c199e90c2a601d34625573.zip |
updated
Diffstat (limited to 'perl-install/install_steps.pm')
-rw-r--r-- | perl-install/install_steps.pm | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm index b07443235..b6d885a78 100644 --- a/perl-install/install_steps.pm +++ b/perl-install/install_steps.pm @@ -603,6 +603,27 @@ sub setRootPassword($) { print F $_; } } +sub setAdminPassword($) { + my ($o) = @_; + my $p = $o->{prefix}; + my $u = $o->{adminuser} ||= {}; + + $u->{pw} ||= $u->{password} && any::crypt($u->{password}, $o->{authentication}{md5}); + + my @lines = cat_(my $f = "$p/etc/passwd") or log::l("missing passwd file"), return; + + local *F; + open F, "> $f" or die "failed to write file $f: $!\n"; + foreach (@lines) { + if (/^admin:/) { + chomp; + my %l; @l{@etc_pass_fields} = split ':'; + add2hash($u, \%l); + $_ = join(':', @$u{@etc_pass_fields}) . "\n"; + } + print F $_; + } +} #------------------------------------------------------------------------------ |