File 0001-utils-Add-auth-config-hook-script-for-SUSE.patch of Package gdm

From d3d415bc80063d11f68f1a118c94a7c60558c6fe Mon Sep 17 00:00:00 2001
From: Alynx Zhou <alynx.zhou@gmail.com>
Date: Wed, 26 Mar 2025 15:06:33 +0800
Subject: [PATCH] utils: Add auth config hook script for SUSE

Currently a no-op hook script is used because we don't require other
operations now, this is just make gdm-config work without errors.
---
 meson.build                |  2 +
 utils/gdm-auth-config-suse | 98 ++++++++++++++++++++++++++++++++++++++
 utils/meson.build          |  1 +
 3 files changed, 101 insertions(+)
 create mode 100755 utils/gdm-auth-config-suse

diff --git a/meson.build b/meson.build
index 8da5ae878..62ab61abe 100644
--- a/meson.build
+++ b/meson.build
@@ -201,6 +201,8 @@ distro_autodetect_map = {
   '/etc/exherbo-release': 'exherbo',
   '/etc/arch-release': 'arch',
   '/etc/lfs-release': 'lfs',
+  '/etc/SUSE-brand': 'suse',
+  '/usr/etc/SUSE-brand': 'suse',
 }
 
 distro = get_option('distro')
diff --git a/utils/gdm-auth-config-suse b/utils/gdm-auth-config-suse
new file mode 100755
index 000000000..ea05a0e43
--- /dev/null
+++ b/utils/gdm-auth-config-suse
@@ -0,0 +1,98 @@
+#!/usr/bin/env bash
+#
+# Copyright (C) 2020 Marco Trevisan <marco.trevisan@canonical.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+
+command=$1
+action=$2
+action_setting=$3
+
+set -e
+export LANG=C
+
+ENABLED="enabled"
+DISABLED="disabled"
+REQUIRED="required"
+STOP=19
+
+
+case "$command" in
+    show)
+        case "$action" in
+            password)
+            ;;
+            smartcard)
+            ;;
+            fingerprint)
+            ;;
+        esac
+
+        exit 0;
+    ;;
+
+    smartcard)
+        case "$action" in
+            enable)
+            ;;
+            require)
+                # While we can't require anything here, we assume that GDM
+                # will disable the password authentication in this case.
+            ;;
+            disable)
+            ;;
+            removal-action)
+            ;;
+        esac
+
+        # We assume the default handler can manage this, as gdm already
+        # provides a PAM config file for this case
+        exit 0
+    ;;
+
+    fingerprint)
+        case "$action" in
+            enable)
+            ;;
+            require)
+                exit 1
+            ;;
+            disable)
+            ;;
+        esac
+
+        # We assume the default handler can manage this, as gdm already
+        # provides a PAM config file for this case
+        exit 0
+    ;;
+
+    password)
+        # We assume the default handler can manage this, as gdm already
+        # provides a PAM config file for this case
+        exit 0
+    ;;
+
+    reset)
+        exit 0
+    ;;
+
+    *)
+        # Use default behavior
+        exit 0;
+    ;;
+esac
+
+exit 1
diff --git a/utils/meson.build b/utils/meson.build
index 2cfbd1471..8280918b1 100644
--- a/utils/meson.build
+++ b/utils/meson.build
@@ -37,6 +37,7 @@ gdm_auth_config = executable('gdm-config',
 
 auth_config_distro_hooks = [
   'redhat',
+  'suse',
   'generic',
 ]
 
-- 
2.49.0

openSUSE Build Service is sponsored by