diff options
-rw-r--r-- | perl-install/NEWS | 2 | ||||
-rw-r--r-- | perl-install/any.pm | 41 |
2 files changed, 19 insertions, 24 deletions
diff --git a/perl-install/NEWS b/perl-install/NEWS index b46a58776..294e95a29 100644 --- a/perl-install/NEWS +++ b/perl-install/NEWS @@ -1,3 +1,5 @@ +- drakautologin: add new functions get_session_file and get_session_file_with_extension + Version 18.16 - 11 May 2019 - Mageia 7 Artwork diff --git a/perl-install/any.pm b/perl-install/any.pm index 96d201565..d89b04d6f 100644 --- a/perl-install/any.pm +++ b/perl-install/any.pm @@ -748,13 +748,21 @@ sub setupBootloader__grub2 { } } -sub adapt_desktop_for_plasma { +sub get_session_file { my ($desktop) = @_; - my %h = ( - 'Plasma' => '01plasma', - 'GNOME Classic' => 'gnome-classic', - ); - return $desktop ? ($h{$desktop} || lc($desktop)) . '.desktop' : ''; + my $xsession_file = find { + my %xsession = read_gnomekderc($_, 'Desktop Entry'); + $xsession{Name} =~ s/\s+//g; + $xsession{Name} eq ${desktop}; + } glob("$::prefix/usr/share/xsessions/*.desktop"); + $xsession_file =~ s!\.[^.]+$!!; + $xsession_file =~ s!.*/!!; + $xsession_file ||= $desktop; + return $xsession_file; +} + +sub get_session_file_with_extension { + return get_session_file(@_) . '.desktop'; } sub available_dms() { @@ -828,7 +836,7 @@ sub set_autologin { #- Configure SDDM my $sddm_conffile = "$::prefix/etc/sddm.conf"; eval { common::update_gnomekderc_no_create($sddm_conffile, 'Autologin' => ( - Session => adapt_desktop_for_plasma($autologin->{desktop}), + Session => get_session_file_with_extension($autologin->{desktop}), User => $autologin->{user}, )) } if -e $sddm_conffile; @@ -841,18 +849,10 @@ sub set_autologin { #- Configure LIGHTDM my $lightdm_conffile = "$::prefix/etc/lightdm/lightdm.conf.d/50-mageia-autologin.conf"; - my $xsession_file = find { - my %xsession = read_gnomekderc($_, 'Desktop Entry'); - $xsession{Name} =~ s/\s+//g; - $xsession{Name} eq $autologin->{desktop}; - } glob("$::prefix/usr/share/xsessions/*.desktop"); - $xsession_file =~ s!\.[^.]+$!!; - $xsession_file =~ s!.*/!!; - $xsession_file ||= $autologin->{desktop}; eval { update_gnomekderc($lightdm_conffile, 'Seat:*' => ( '#dummy-autologin' => $do_autologin, 'autologin-user' => $autologin->{user}, - 'autologin-session' => $xsession_file, + 'autologin-session' => get_session_file($autologin->{desktop}), )) } if -e $lightdm_conffile; #- Configure LXDM @@ -861,16 +861,9 @@ sub set_autologin { 'autologin' => $autologin->{user} ? '@' . $autologin->{user} : '' )); if ($autologin->{user} && $autologin->{desktop} && !member($autologin->{desktop}, qw(default failsafe))) { - my $xsession_file = find { - my %xsession = read_gnomekderc($_, 'Desktop Entry'); - $xsession{Name} eq $autologin->{desktop}; - } glob("$::prefix/usr/share/xsessions/*.desktop"); - $xsession_file =~ s!\.[^.]+$!!; - $xsession_file =~ s!.*/!!; - $xsession_file ||= $autologin->{desktop}; update_gnomekderc($lxdm_conffile, $autologin->{user} => ( 'user' => $autologin->{user}, - 'session' => $xsession_file, + 'session' => get_session_file($autologin->{desktop}), )) } } if -e $lxdm_conffile; my $xdm_autologin_cfg = "$::prefix/etc/sysconfig/autologin"; |