summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordamien <damien@mandriva.com>2000-12-21 12:35:29 +0000
committerdamien <damien@mandriva.com>2000-12-21 12:35:29 +0000
commitc56b64b92e2f866dfde41aff470e3cd70ce14d8b (patch)
treec2dc30374bdec70c68a4af905729b8dcb9aa300c
parentbcf7157e9f5fa5eb3ea2a4925d97ef5d26c9347d (diff)
downloaddrakx-c56b64b92e2f866dfde41aff470e3cd70ce14d8b.tar
drakx-c56b64b92e2f866dfde41aff470e3cd70ce14d8b.tar.gz
drakx-c56b64b92e2f866dfde41aff470e3cd70ce14d8b.tar.bz2
drakx-c56b64b92e2f866dfde41aff470e3cd70ce14d8b.tar.xz
drakx-c56b64b92e2f866dfde41aff470e3cd70ce14d8b.zip
added setAdminpassword (a little bit redundant, sorry)
-rw-r--r--perl-install/install_steps.pm23
1 files changed, 23 insertions, 0 deletions
diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm
index b07443235..9beec337b 100644
--- a/perl-install/install_steps.pm
+++ b/perl-install/install_steps.pm
@@ -606,6 +606,29 @@ sub setRootPassword($) {
#------------------------------------------------------------------------------
+my @etc_pass_fields = qw(name pw uid gid realname home shell);
+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 $_;
+ }
+}
+
sub addUser($) {
my ($o) = @_;
my $p = $o->{prefix};