From 0c4440409357dafaf742896053f0165402ec9e6b Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Wed, 10 Jan 2001 14:01:55 +0000 Subject: (addUser): use any::pack_passwd (setRootPassword): use any::unpack_passwd and any::pack_passwd --- perl-install/install_steps.pm | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'perl-install') diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm index 197f2c563..27bfcf1ac 100644 --- a/perl-install/install_steps.pm +++ b/perl-install/install_steps.pm @@ -551,8 +551,7 @@ sub configurePrinter { } #------------------------------------------------------------------------------ -my @etc_pass_fields = qw(name pw uid gid realname home shell); -sub setRootPassword($) { +sub setRootPassword { my ($o) = @_; my $p = $o->{prefix}; my $u = $o->{superuser} ||= {}; @@ -565,10 +564,8 @@ sub setRootPassword($) { open F, "> $f" or die "failed to write file $f: $!\n"; foreach (@lines) { if (/^root:/) { - chomp; - my %l; @l{@etc_pass_fields} = split ':'; - add2hash($u, \%l); - $_ = join(':', @$u{@etc_pass_fields}) . "\n"; + add2hash($u, any::unpack_passwd($_)); + $_ = any::pack_passwd($_); } print F $_; } @@ -607,7 +604,7 @@ sub addUser($) { local *F; open F, ">> $p/etc/passwd" or die "can't append to passwd file: $!"; - print F join(':', @$_{@etc_pass_fields}), "\n" foreach @l; + print F any::pack_passwd($_) foreach @l; open F, ">> $p/etc/group" or die "can't append to group file: $!"; print F "$_->{name}:x:$_->{gid}:\n" foreach @l; -- cgit v1.2.1