summaryrefslogtreecommitdiffstats
path: root/perl-install/any.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/any.pm')
-rw-r--r--perl-install/any.pm27
1 files changed, 25 insertions, 2 deletions
diff --git a/perl-install/any.pm b/perl-install/any.pm
index bc1ed3011..a2237f85d 100644
--- a/perl-install/any.pm
+++ b/perl-install/any.pm
@@ -236,8 +236,31 @@ _("Default") => { val => \$default, type => 'bool' },
}
sub setAutologin {
- my ($prefix, $user) = @_;
- setVarsInSh("$prefix/etc/sysconfig/autologin",
+ my ($prefix, $user, $desktop) = @_;
+ $user and do {
+ local *F;
+ open F, ">$prefix/home/$user/.wmrc" or die "Can't open $!";
+ print F $desktop;
+ close F;
+ };
+ my @wm = (qw(gnome ice maker kde after fvwm fvwm2 fvwm95 mwm twm enligh xfce blackbox sawfish));
+ my @wm2 = (qw(gnome-session icewm wmaker kdestart afterstep fvwm fvwm2 fvwm95 mwm twm enlightenment xfce blackbox sawfish));
+ my $i=0;
+ foreach (@wm) {
+ lc($desktop) =~ /$_/ and $desktop = $wm2[$i] and last;
+ $i++;
+ }
+ my $f = "$prefix/home/$user/.xinitrc";
+ -e $f or do {
+ open F, ">$f" or die "Can't open $!";
+ print F "# Mandrake-Autologin : if you remove this comment, I won't ever edit this file.";
+ close F; };
+ cat_($f) =~ /^# Mandrake-Autologin.*\n/ and do {
+ substInFile {
+ s/^exec .*\n//;
+ $_ = "exec $desktop\n" . $_ if eof;
+ } "$prefix/home/$user/.xinitrc"; };
+ setVarsInSh("$prefix/etc/sysconfig/autologin",
{ USER => $user, AUTOLOGIN => bool2yesno($user), EXEC => "/usr/X11R6/bin/startx" });
}