summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorMartin Whitaker <mageia@martin-whitaker.me.uk>2025-12-26 15:36:41 +0000
committerMartin Whitaker <mageia@martin-whitaker.me.uk>2025-12-26 15:36:41 +0000
commit01746578e0a60047bf7c92d91636e2de65a7161a (patch)
tree4afa12eff0e8e38fe38e41b3f32164d78cf44b51 /perl-install
parent30df90dd27d4227d22877e236618e50caf7e8f2e (diff)
downloaddrakx-01746578e0a60047bf7c92d91636e2de65a7161a.tar
drakx-01746578e0a60047bf7c92d91636e2de65a7161a.tar.gz
drakx-01746578e0a60047bf7c92d91636e2de65a7161a.tar.bz2
drakx-01746578e0a60047bf7c92d91636e2de65a7161a.tar.xz
drakx-01746578e0a60047bf7c92d91636e2de65a7161a.zip
Fix desktop_to_dm in any::get_autologin() to handle new session names.
There are now multiple session files in /usr/share/xsessions and in /usr/share/wayland-sessions for each DE, so the old hash table was both broken and inadequate. Replace with a subroutine that uses case-insensitive regex matching, which should be more future-proof.
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/any.pm23
1 files changed, 16 insertions, 7 deletions
diff --git a/perl-install/any.pm b/perl-install/any.pm
index dc0d112e1..f334bf700 100644
--- a/perl-install/any.pm
+++ b/perl-install/any.pm
@@ -842,6 +842,21 @@ sub available_dms() {
@l;
}
+sub desktop_to_dm {
+ my ($desktop) = @_;
+ if ($desktop =~ /gnome/i) {
+ 'gdm';
+ } elsif ($desktop =~ /lxqt|plasma/i) {
+ 'sddm';
+ } elsif ($desktop =~ /cinnamon|mate|xfce/i) {
+ 'lightdm';
+ } elsif ($desktop =~ /lxde/i) {
+ 'lxdm';
+ } else {
+ '';
+ }
+}
+
sub get_autologin() {
my %desktop = getVarsFromSh("$::prefix/etc/sysconfig/desktop");
my $gdm_file = "$::prefix/etc/X11/gdm/custom.conf";
@@ -850,15 +865,9 @@ sub get_autologin() {
my $lxdm_conffile = "$::prefix/etc/lxdm/lxdm.conf";
my $autologin_file = "$::prefix/etc/sysconfig/autologin";
my $desktop = $desktop{DESKTOP} || first(sessions());
- my %desktop_to_dm = (
- GNOME => 'gdm',
- Plasma => 'sddm',
- Xfce => 'lightdm',
- LXDE => 'lxdm',
- );
my $dm =
basename(readlink("$::prefix/etc/systemd/system/display-manager.service")) =~ s/(.*)\.service/$1/r ||
- $desktop_to_dm{$desktop} ||
+ desktop_to_dm($desktop) ||
basename(first(available_dms()));
my $autologin_user;