diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2003-07-30 17:09:53 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2003-07-30 17:09:53 +0000 |
commit | 2cff61995bff331d449026e5c84b6180792ea99b (patch) | |
tree | 1421462888810d6633ad7626b07306b9373e6d7b | |
parent | bb11683e1cc5ffe127356ba43e788e8aff012f70 (diff) | |
download | drakx-2cff61995bff331d449026e5c84b6180792ea99b.tar drakx-2cff61995bff331d449026e5c84b6180792ea99b.tar.gz drakx-2cff61995bff331d449026e5c84b6180792ea99b.tar.bz2 drakx-2cff61995bff331d449026e5c84b6180792ea99b.tar.xz drakx-2cff61995bff331d449026e5c84b6180792ea99b.zip |
- cleanup debug code
- use read_gnomekderc & update_gnomekderc instead of getVarsFromSh & substInFile
-rw-r--r-- | perl-install/any.pm | 62 |
1 files changed, 30 insertions, 32 deletions
diff --git a/perl-install/any.pm b/perl-install/any.pm index d86dde580..0be5d0658 100644 --- a/perl-install/any.pm +++ b/perl-install/any.pm @@ -456,44 +456,42 @@ sub pack_passwd { } sub get_autologin { - my ($_o) = @_; my %desktop = getVarsFromSh("$::prefix/etc/sysconfig/desktop"); - my $dm = $desktop{DISPLAYMANAGER}; my $desktop = $desktop{DESKTOP} || 'KDE'; - if ($desktop{DISPLAYMANAGER} eq 'GNOME') { - my %l = getVarsFromSh("$::prefix/etc/X11/gdm/gdm.conf"); - return { autologin => text2bool($l{AutomaticLoginEnable}) && $l{AutomaticLogin}, desktop => $desktop }; - } else { # KDM / MdkKDM - my %l = getVarsFromSh("$::prefix/usr/share/config/kdm/kdmrc"); - return { autologin => text2bool($l{AutoLoginEnable}) && $l{AutoLoginUser}, desktop => $desktop }; - } + my $autologin = do { + if (($desktop{DISPLAYMANAGER} || $desktop) eq 'GNOME') { + my %conf = read_gnomekderc("$::prefix/etc/X11/gdm/gdm.conf", 'daemon'); + text2bool($conf{AutomaticLoginEnable}) && $conf{AutomaticLogin}; + } else { # KDM / MdkKDM + my %conf = read_gnomekderc("$::prefix/usr/share/config/kdm/kdmrc", 'X-:0-Core'); + text2bool($conf{AutoLoginEnable}) && $conf{AutoLoginUser}; + } + }; + { autologin => $autologin, desktop => $desktop }; } sub set_autologin { - my ($user, $desktop) = @_; - print "\n\nconfig => ($user, $desktop)\n"; - my $autologin = bool2text($user); - my $found; - # Configure KDM / MDKKDM - substInFile { - s/^(AutoLoginEnable=).*/$1$autologin/; - $found ||= s/^(AutoLoginUser=).*/$1$user/; - } "$::prefix/usr/share/config/kdm/kdmrc"; - substInFile { - s/^(AutoLoginEnable=.*)$/$1\nAutoLoginUser=$user/; - } "$::prefix/usr/share/config/kdm/kdmrc" if !$found; - # Configure GDM - substInFile { - s/^(AutomaticLoginEnable=).*/$1$autologin/; - s/^(AutomaticLogin=).*/$1$user/; - } "$::prefix/etc/X11/gdm/gdm.conf"; + my ($user, $desktop) = @_; + my $autologin = bool2text($user); + + #- Configure KDM / MDKKDM + eval { update_gnomekderc("$::prefix/usr/share/config/kdm/kdmrc", 'X-:0-Core' => ( + AutoLoginEnable => $autologin, + AutoLoginUser => $user, + )) }; + + #- Configure GDM + eval { update_gnomekderc("$::prefix/etc/X11/gdm/gdm.conf", daemon => ( + AutomaticLoginEnable => $autologin, + AutomaticLogin => $user, + )) }; - if ($user) { - my %l = getVarsFromSh("$::prefix/etc/sysconfig/desktop"); - $l{DESKTOP} = $desktop; - setVarsInSh("$::prefix/etc/sysconfig/desktop", \%l); - log::l("cat $::prefix/etc/sysconfig/desktop ($desktop):\n", cat_("$::prefix/etc/sysconfig/desktop")); - } + if ($user) { + my %l = getVarsFromSh("$::prefix/etc/sysconfig/desktop"); + $l{DESKTOP} = $desktop; + setVarsInSh("$::prefix/etc/sysconfig/desktop", \%l); + log::l("cat $::prefix/etc/sysconfig/desktop ($desktop):\n", cat_("$::prefix/etc/sysconfig/desktop")); + } } sub rotate_log { |