diff options
| author | Martin Whitaker <mageia@martin-whitaker.me.uk> | 2025-12-27 10:19:33 +0000 |
|---|---|---|
| committer | Martin Whitaker <mageia@martin-whitaker.me.uk> | 2025-12-27 10:49:27 +0000 |
| commit | f7332a41ccbc247fc43bb6d0d9833fea25b9dbc5 (patch) | |
| tree | 7ba43d43c7aa2ae0260b0d5393666c710ca09a49 /perl-install | |
| parent | 6147dedfc0db16f187172136c7fce9aee81c7466 (diff) | |
| download | drakx-f7332a41ccbc247fc43bb6d0d9833fea25b9dbc5.tar drakx-f7332a41ccbc247fc43bb6d0d9833fea25b9dbc5.tar.gz drakx-f7332a41ccbc247fc43bb6d0d9833fea25b9dbc5.tar.bz2 drakx-f7332a41ccbc247fc43bb6d0d9833fea25b9dbc5.tar.xz drakx-f7332a41ccbc247fc43bb6d0d9833fea25b9dbc5.zip | |
Simplify set_autologin().
Using the new session_files() subroutine allows us to eliminate
get_session_file() and get_session_file_with_extension().
Diffstat (limited to 'perl-install')
| -rw-r--r-- | perl-install/any.pm | 33 |
1 files changed, 7 insertions, 26 deletions
diff --git a/perl-install/any.pm b/perl-install/any.pm index 2b80d929a..9b47bcf56 100644 --- a/perl-install/any.pm +++ b/perl-install/any.pm @@ -835,28 +835,6 @@ sub session_names() { sort(keys %session_files); } -sub get_session_file { - my ($desktop) = @_; - my @dir_wm = qw(xsessions wayland-sessions); - my $xsession_file; - foreach my $dwm (@dir_wm) { - my $xs_file = find { - my %xsession = read_gnomekderc($_, 'Desktop Entry'); - $xsession{Name} =~ s/\s+//g; - $xsession{Name} eq ${desktop}; - } glob("$::prefix/usr/share/$dwm/*.desktop"); - $xsession_file = $xs_file unless $xsession_file; - } - $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() { my @l; foreach (glob("$::prefix/usr/share/X11/dm.d/*.conf")) { @@ -934,10 +912,13 @@ sub set_autologin { or return; } + my %session_files = session_files(); + my $session_basename = $session_files{$autologin->{desktop}}->{basename} || ''; + #- Configure SDDM my $sddm_conffile = "$::prefix/etc/sddm.conf"; eval { common::update_gnomekderc_no_create($sddm_conffile, 'Autologin' => ( - Session => get_session_file_with_extension($autologin->{desktop}), + Session => "$session_basename.desktop", User => $autologin->{user}, )) } if -e $sddm_conffile; @@ -950,7 +931,7 @@ sub set_autologin { if ($autologin->{user}) { $gdm_conffile = "$::prefix/var/lib/AccountsService/users/" . $autologin->{user}; eval { update_gnomekderc($gdm_conffile, User => ( - Session => get_session_file($autologin->{desktop}), + Session => $session_basename, )) }; } @@ -959,7 +940,7 @@ sub set_autologin { eval { update_gnomekderc($lightdm_conffile, 'Seat:*' => ( '#dummy-autologin' => $do_autologin, 'autologin-user' => $autologin->{user}, - 'autologin-session' => get_session_file($autologin->{desktop}), + 'autologin-session' => $session_basename, )) } if -e $lightdm_conffile; #- Configure LXDM @@ -970,7 +951,7 @@ sub set_autologin { if ($autologin->{user} && $autologin->{desktop} && !member($autologin->{desktop}, qw(default failsafe))) { update_gnomekderc($lxdm_conffile, $autologin->{user} => ( 'user' => $autologin->{user}, - 'session' => get_session_file($autologin->{desktop}), + 'session' => $session_basename, )) } } if -e $lxdm_conffile; #- Configure XDM |
