From 58f7e07eacda17f8cb2cb8ef18ed2b8e6a2db86d Mon Sep 17 00:00:00 2001
From: Olivier Blin <oblin@mandriva.com>
Date: Fri, 21 Sep 2007 11:24:44 +0000
Subject: read gdm autologin settings

---
 perl-install/NEWS   | 1 +
 perl-install/any.pm | 8 +++++---
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/perl-install/NEWS b/perl-install/NEWS
index c5ca54703..a4333c5d2 100644
--- a/perl-install/NEWS
+++ b/perl-install/NEWS
@@ -5,6 +5,7 @@
   o write autologin settings after user creation only
     (so that home is set and exists, should partly fix GNOME autologin)
   o config first user to autologin if USER_AUTOLOGIN_FIRST is "yes"
+  o read gdm autologin settings
 
 Version 10.4.207 - 21 September 2007, by Thierry Vignaud
 
diff --git a/perl-install/any.pm b/perl-install/any.pm
index e2a3d0309..cdd775b8a 100644
--- a/perl-install/any.pm
+++ b/perl-install/any.pm
@@ -591,13 +591,15 @@ You can create additional entries or change the existing ones."), [ {
 
 sub get_autologin() {
     my %desktop = getVarsFromSh("$::prefix/etc/sysconfig/desktop");
-    my $desktop = $desktop{DESKTOP} || 'KDE';
+    my $gdm_file= "$::prefix/etc/X11/gdm/custom.conf";
+    my $kdm_file = "$::prefix/etc/kde/kdm/kdmrc";
+    my $desktop = $desktop{DESKTOP} || (! -e $kdm_file && -e $gdm_file ? 'GNOME' : 'KDE');
     my $autologin = do {
 	if (($desktop{DISPLAYMANAGER} || $desktop) eq 'GNOME') {
-	    my %conf = read_gnomekderc("$::prefix/etc/X11/gdm/custom.conf", 'daemon');
+	    my %conf = read_gnomekderc($gdm_file, 'daemon');
 	    text2bool($conf{AutomaticLoginEnable}) && $conf{AutomaticLogin};
 	} else { # KDM / MdkKDM
-	    my %conf = read_gnomekderc("$::prefix/etc/kde/kdm/kdmrc", 'X-:0-Core');
+	    my %conf = read_gnomekderc($kdm_file, 'X-:0-Core');
 	    text2bool($conf{AutoLoginEnable}) && $conf{AutoLoginUser};
 	}
     };
-- 
cgit v1.2.1