2 Commits

Author SHA256 Message Date
Xiaoguang Wang
0fb5259092 Add gdm-service-keytable.patch(bsc#1248831, bsc#1250366) 2025-09-23 17:48:02 +08:00
Xiaoguang Wang
eaca0737b4 Create /run/gdm in case it would not exist yet(boo#1249017) 2025-09-23 17:46:49 +08:00
4 changed files with 109 additions and 4 deletions

View File

@@ -0,0 +1,12 @@
Index: gdm-48.0/data/gdm.service.in
===================================================================
--- gdm-48.0.orig/data/gdm.service.in
+++ gdm-48.0/data/gdm.service.in
@@ -20,6 +20,7 @@ After=rc-local.service plymouth-start.se
OnFailure=plymouth-quit.service
[Service]
+ExecStartPre=-/usr/libexec/gdm/keytable
ExecStart=${sbindir}/gdm
KillMode=mixed
Restart=always

View File

@@ -1,3 +1,25 @@
-------------------------------------------------------------------
Tue Sep 23 08:52:11 UTC 2025 - Yifan Jiang <yfjiang@suse.com>
- Add gdm-service-keytable.patch: set KEYMAP to XkbLayout for GNOME
when using gdm-systemd instead of xdm (bsc#1248831, bsc#1250366).
-------------------------------------------------------------------
Thu Sep 11 10:57:19 UTC 2025 - Dominique Leuenberger <dimstar@opensuse.org>
- Create /run/gdm in case it would not exist yet; this could
potentially happen on offline upgrades.
-------------------------------------------------------------------
Mon Sep 1 11:02:31 UTC 2025 - Dominique Leuenberger <dimstar@opensuse.org>
- Move migration marker from /var/tmp to /run/gdm (boo#1249017).
-------------------------------------------------------------------
Fri Aug 29 10:18:55 UTC 2025 - Dominique Leuenberger <dimstar@opensuse.org>
- Fix syntax error in gdm's %pre script.
-------------------------------------------------------------------
Tue Aug 6 06:55:48 UTC 2025 - Xiaoguang Wang <xiaoguang.wang@suse.com>

View File

@@ -57,6 +57,7 @@ Source14: gdm-fingerprint-sle.pamd
Source15: gdm-smartcard-sle.pamd
# Configuration for pulseaudio
Source20: default.pa
Source21: keytable.in
# WARNING: do not remove/significantly change patch0 without updating the relevant patch in accountsservice too
# PATCH-FIX-OPENSUSE gdm-s390-not-require-g-s-d_wacom.patch bsc#1129412 yfjiang@suse.com -- Remove the runtime requirement of g-s-d Wacom plugin
Patch0: gdm-s390-not-require-g-s-d_wacom.patch
@@ -76,6 +77,8 @@ Patch7: gdm-settings-utils_rename-variable.patch
Patch8: gdm-fix-wrong-path-gdm-config.patch
# PATCH-FIX-UPSTREAM gdm-plymouth-quit-wait.patch bsc#1243439 xwang@suse.com -- Disable plymouth-quit-wait.service
Patch9: gdm-plymouth-quit-wait.patch
# PATCH-FIX-OPENSUSE gdm-service-keytable.patch bsc#1248831 bsc#1250366 yfjiang@suse.com -- set KEYMAP to XkbLayout for GNOME
Patch10: gdm-service-keytable.patch
### NOTE: Keep please SLE-only patches at bottom (starting on 1000).
# PATCH-FIX-SLE gdm-disable-gnome-initial-setup.patch bnc#1067976 qzhao@suse.com -- Disable gnome-initial-setup runs before gdm, g-i-s will only serve for CJK people to choose the input-method after login.
@@ -355,6 +358,8 @@ install -m 644 %{SOURCE11} %{buildroot}%{_sysusersdir}/gdm.conf
install -D -m 644 %{SOURCE20} %{buildroot}%{_prefix}/share/factory/var/lib/gdm/.pulse/default.pa
%endif
install -m 755 %{SOURCE21} %{buildroot}%{_libexecdir}/gdm/keytable
%find_lang %{name} %{?no_lang_C}
%fdupes -s %{buildroot}%{_datadir}/help
@@ -363,9 +368,10 @@ install -D -m 644 %{SOURCE20} %{buildroot}%{_prefix}/share/factory/var/lib/gdm/.
%pre -f gdm.pre
if [ $1 -gt 1 ]; then
if [ "$(systemctl is-enabled display-manager-legacy)" = "enabled" -a -x /usr/sbin/update-alternatives]; then
if [ "$(systemctl is-enabled display-manager-legacy)" = "enabled" -a -x /usr/sbin/update-alternatives ]; then
if [ "$(update-alternatives --query default-displaymanager | awk '/Value:/ {print $2}')" = "/usr/lib/X11/displaymanagers/gdm" ]; then
touch /var/tmp/migrate_to_gdm
mkdir -p /run/gdm
touch /run/gdm/migrate_to_gdm
fi
fi
fi
@@ -405,11 +411,11 @@ if [ "$(systemctl is-enabled display-manager-legacy)" = "enabled" ]; then
# display-manager is currently 'legacy mode' - if migration has already occured
# the above command would return 'disabled'
if [ -x /usr/sbin/update-alternatives ]; then
if [ "$(update-alternatives --query default-displaymanager | awk '/Value:/ {print $2}')" = "/usr/lib/X11/displaymanagers/gdm" ] || [ -f /var/tmp/migrate_to_gdm ]; then
if [ "$(update-alternatives --query default-displaymanager | awk '/Value:/ {print $2}')" = "/usr/lib/X11/displaymanagers/gdm" ] || [ -f /run/gdm/migrate_to_gdm ]; then
# the display-manager started by xdm is currently gdm - let's switch to the native service
# this only force-enables gdm whenever xdm was enabled AND it was uses as wrapper to start gdm
systemctl enable --force gdm.service
unlink /var/tmp/migrate_to_gdm
unlink /run/gdm/migrate_to_gdm || :
fi
fi
fi
@@ -495,6 +501,7 @@ fi
%files systemd
%{_unitdir}/gdm.service
%{_libexecdir}/gdm/keytable
%files -n gdmflexiserver
%{_bindir}/gdmflexiserver

64
keytable.in Normal file
View File

@@ -0,0 +1,64 @@
#! /bin/bash
if [ $UID -ne 0 ]; then
echo "You need to be root to run this program"
exit 0
fi
vconsole_conf_file=/etc/vconsole.conf
previous_x11conf_file=/etc/X11/xorg.conf.d/90-keytable.conf
systemd_x11conf_file=/etc/X11/xorg.conf.d/00-keyboard.conf
keyboard_map_systemd=/usr/share/systemd/kbd-model-map
function setkeyboard {
echo "Command: localectl set-keymap $1 $2"
# xorg.conf.d snippet is only written if a valid snippet is already
# available, so create an us sample if neccessary
if [ ! -f $systemd_x11conf_file ]; then
localectl set-x11-keymap us
fi
# check systemd mapping
NEWKEYMAP=$(echo "$1" | sed "s/ $//" )
opts=$(grep -P "^$NEWKEYMAP\t" "$keyboard_map_systemd" | sed -re "s/[^\t]*//" -e "s/[\t]+/ /g" )
if [ -z "$opts" ]; then
echo "W: Cannot find mapping for $NEWKEYMAP in $keyboard_map_systemd"
echo "W: This will result in an 'us' X keyboard layout as default"
else
echo "I: Using systemd $keyboard_map_systemd mapping"
fi
localectl set-keymap $1 $2
if [ -f $systemd_x11conf_file ]; then
if [ -f $previous_x11conf_file ]; then
if [ $systemd_x11conf_file -nt $previous_x11conf_file ]; then
rm -f $previous_x11conf_file
fi
fi
exit 0
else
echo "$systemd_x11conf_file has not been created!"
fi
}
if [ -f $vconsole_conf_file ]; then
echo "$vconsole_conf_file available"
. $vconsole_conf_file
if [ ! -z $KEYMAP ]; then
if [ -z $XKBLAYOUT ]; then
echo "KEYMAP: $KEYMAP"
setkeyboard $KEYMAP $KEYMAP_TOGGLE
else
echo "XKBLAYOUT: $XKBLAYOUT"
echo "XKBLAYOUT is already set. Better don't touch X11 keyboard configuration."
exit 0
fi
else
echo "KEYMAP not set"
fi
else
echo "$vconsole_conf_file not available"
fi
echo "Keyboard layout could not be set"
exit 1