From bdea551682ad304b20003f6f525c1aa9fdc82d5d Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Wed, 10 Jan 2001 14:01:37 +0000 Subject: (setAutologin): cleanup (pack_passwd, unpack_passwd): created --- perl-install/any.pm | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'perl-install/any.pm') diff --git a/perl-install/any.pm b/perl-install/any.pm index 4cdc24e83..676b6feac 100644 --- a/perl-install/any.pm +++ b/perl-install/any.pm @@ -243,14 +243,23 @@ arch() !~ /sparc/ ? ( 1; } +my @etc_pass_fields = qw(name pw uid gid realname home shell); +sub unpack_passwd { + my ($l) = @_; + chomp $l; + my %l; @l{@etc_pass_fields} = split ':', $l; + \%l; +} +sub pack_passwd { + my ($l) = @_; + join(':', @$l{@etc_pass_fields}) . "\n"; +} + sub setAutologin { my ($prefix, $user, $desktop) = @_; - if ($user) { - local *F; - open F, ">$prefix/etc/sysconfig/desktop" or die "Can't open $!"; - print F uc($desktop) . "\n"; - close F; - } + + output "$prefix/etc/sysconfig/desktop", uc($desktop), "\n" if $user; + setVarsInSh("$prefix/etc/sysconfig/autologin", { USER => $user, AUTOLOGIN => bool2yesno($user), EXEC => "/usr/X11R6/bin/startx" }); } -- cgit v1.2.1