File gdm.spec of Package gdm.16051

#
# spec file for package gdm
#
# Copyright (c) 2020 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


# We can enable systemd support only if we have xorg 1.12, as it means
# starting X with --seat, and only if we build the whole system with
# systemd support (for instance, NetworkManager).
%define with_systemd 1
%if %{with_systemd}
%define systemdsystemunitdir %(pkg-config --variable=systemdsystemunitdir systemd)
%endif
# FIXME: need to check what should be done to enable this (at least adapt the pam files). See bnc#699999
%define enable_split_authentication 0

Name:           gdm
Version:        3.10.0.1
Release:        0
Summary:        The GNOME Display Manager
License:        GPL-2.0-or-later
Group:          System/GUI/GNOME
URL:            http://projects.gnome.org/gdm/
Source:         http://download.gnome.org/sources/gdm/3.10/%{name}-%{version}.tar.xz
Source1:        gdm.pamd
Source2:        gdm-autologin.pamd
Source3:        gdm-launch-environment.pamd
Source6:        gdm-fingerprint.pamd
Source7:        gdm-smartcard.pamd
# gdmflexiserver wrapper, to enable other display managers to abuse the gdmflexiserver namespace (like lightdm)
Source4:        gdmflexiserver-wrapper
# /etc/xinit.d/xdm integration script
Source5:        X11-displaymanager-gdm
# GDM does not boostrap using gnome-autogen.sh, but has it's own bootstrap script
Source8:        autogen.sh
# PATCH-FIX-OPENSUSE gdm-is-not-unstable-unless.patch vuntz@opensuse.org -- Make gdm think it's never running a development version unless SUSE_ENABLE_UNSTABLE_CHECK is set. This disables fatal warnings as well as abusive log
Patch3:         gdm-is-not-unstable-unless.patch
# PATCH-NEEDS-REBASE PATCH-FIX-OPENSUSE gdm-desktop-session-env-pam.patch bnc427744 vuntz@novell.com -- Sets a PAM environment variable to let the pam gnome-keyring module know which session is started
Patch6:         gdm-desktop-session-env-pam.patch
# PATCH-FIX-OPENSUSE gdm-suse-xsession.patch vuntz@novell.com -- Use the /etc/X11/xdm/* scripts
Patch7:         gdm-suse-xsession.patch
# WARNING: do not remove/significantly change patch8 without updating the relevant patch in accountsservice too
# PATCH-FIX-OPENSUSE gdm-sysconfig-settings.patch bnc432360 hpj@novell.com -- Read autologin options from /etc/sysconfig/displaymanager; note that accountsservice has a similar patch (accountsservice-sysconfig.patch)
Patch8:         gdm-sysconfig-settings.patch
# PATCH-NEEDS-REBASE PATCH-FEATURE-OPENSUSE gdm-passwordless-login.patch vuntz@opensuse.org -- Support DISPLAYMANAGER_PASSWORD_LESS_LOGIN sysconfig option
Patch9:         gdm-passwordless-login.patch
# PATCH-FIX-OPENSUSE gdm-default-wm.patch vuntz@novell.com -- Use sysconfig to know to which desktop to use by default
Patch34:        gdm-default-wm.patch
# PATCH-FIX-OPENSUSE gdm-xauthlocalhostname.patch bnc#538064 vuntz@novell.com -- Set XAUTHLOCALHOSTNAME to current hostname when we authenticate, for local logins, to avoid issues in the session in case the hostname changes later one. See comment 24 in the bug.
Patch35:        gdm-xauthlocalhostname.patch
# PATCH-FIX-UPSTREAM gdm-look-at-runlevel.patch bnc540482 bgo599180 vuntz@opensuse.org -- Look at the current runlevel before managing the display again, so we don't do this when shutting down or rebooting
Patch40:        gdm-look-at-runlevel.patch
# PATCH-FIX-UPSTREAM gdm-XDMCP-fixes.patch bnc#851160 bgo#690926 dimstar@opensuse.org -- Backported fixes from git for XDMCP remote login
Patch41:        gdm-XDMCP-fixes.patch
# PATCH-FIX-UPSTREAM gdm-worker-ignore-username.patch bgo#721803 fcrozat@suse.com -- fix crash when pam modules returns empty username
Patch42:        gdm-worker-ignore-username.patch
# PATCH-FIX-SLE gdm-disable-journal.patch bnc#867344 fcrozat@suse.com -- ensure journal is properly disabled everywhere 
Patch43:        gdm-disable-journal.patch
# PATCH-FIX-UPSTREAM gdm-leaks-slave.patch bnc#871808 fcrozat@suse.com -- ensure gdm-simple-slave is not leaked, preventing Xorg shutdown
Patch44:        gdm-leaks-slave.patch
# PATCH-FIX-UPSTREAM gdm-launch-environment-explicitly-kill-worker-on-stop-ev.patch bnc#871808 fcrozat@suse.com -- fix PAM session leak
Patch45:        gdm-launch-environment-explicitly-kill-worker-on-stop-ev.patch
# PATCH-FIX-UPSTREAM gdm-slave-fix-infinite-loop-on-shutdown.patch bnc#871808 fcrozat@suse.com -- fix infinite loop on shutdown
Patch46:        gdm-slave-fix-infinite-loop-on-shutdown.patch
# PATCH-FIX-OPENSUSE gdm-plymouth-vt1.patch bnc#881676 fcrozat@suse.com -- switch to VT1 when quitting if gdm was starting with plymouth running
Patch47:        gdm-plymouth-vt1.patch
# PATCH-FIX-SLE gdm-vt-allocation-hack.patch bnc#880006 dliang@suse.com -- add again to open display in the proper vt
Patch48:        gdm-vt-allocation-hack.patch
# PATCH-FIX-SLE gdm-default-wm-sle12.patch bnc#881659 -- set default/fallback session type to SLE Classic
Patch49:        gdm-default-wm-sle12.patch
# PATCH-FIX-UPSTREAM gdm-remote-desktop-unlock.patch bnc#889094 dliang@suse.com --  auth fail while unlock screen in remote session
Patch50:        gdm-remote-desktop-unlock.patch
# PATCH-FIX-UPSTREAM gdm-standadalone-xdmcp-server.patch bgo#567522 fcrozat@suse.com -- allow to start gdm in xdmcp standalone server mode
Patch51:        gdm-standalone-xdmcp-server.patch
# PATCH-FIX-UPSTREAM gdm-correct-ShowLocalGreeter-standalone-XDMCP-server.patch bgo#743440 fcrozat@suse.com -- Ensure ShowLocalGreeter value is properly handled
Patch52:        gdm-correct-ShowLocalGreeter-standalone-XDMCP-server.patch
# PATCH-FIX-SLE gdm-remote-root-login-setting.patch bnc#926264 dliang@suse.com -- support DISPLAYMANAGER_ROOT_LOGIN_REMOTE option
Patch53:        gdm-remote-root-login-setting.patch
# PATCH-FIX-SLE gdm-user-logout-issue.patch bnc#940159 tyang@suse.com -- user logout causes black issues.
Patch54:        gdm-user-logout-issue.patch
# PATCH-FIX-SLE gdm-fix-button-lang.patch bnc#870558 qzhao@suse.com -- fix gdm widget language error.
Patch55:        gdm-fix-button-lang.patch
# PATCH-FIX-SLE gdm-remote-root-passwd-correctness.patch bnc#950751 tyang@suse.com -- not show correctness for remote root user when it's blocked
Patch56:        gdm-remote-root-passwd-correctness.patch
# PATCH-FIX-OPENSUSE gdm-handle-shutdown-at-startup.patch bsc#938874 mgorse@suse.com -- don't crash if system shutting down while we initialize
Patch57:        gdm-handle-shutdown-at-startup.patch
# PATCH-FIX-UPSTREAM gdm-support-XDG_CURRENT_DESKTOP.patch boo#727546, bnc#981261 -- support XDG_CURRENT_DESKTOP
Patch58:        gdm-support-XDG_CURRENT_DESKTOP.patch
# PATCH-FIX-UPSTREAM gdm-tcp-listen.patch bnc#981296 -- Use -listen instead of -nolisten for new Xorg
Patch59:        gdm-tcp-listen.patch
# PATCH-FIX-SLE gdm-always-send-xdmcp-keep-alive.patch bsc#984620 fezhang@suse.com -- always send back xdmcp keep alive
Patch60:        gdm-always-send-xdmcp-keep-alive.patch
# PATCH-FIX-SLE gdm-fails-to-restart-gnome-shell.patch bsc#981976 tyang@suse.com -- Gdm should stop after a few times fails
Patch61:        gdm-fails-to-restart-gnome-shell.patch
# PATCH-FIX-SLE gdm-xsync-warnings.patch bsc#984103 tyang@suse.com -- Stop showing the warning message for user
Patch62:        gdm-xsync-warnings.patch
# PATCH-FIX-UPSTREAM gdm-reduce-hostname-lookups.patch bgo#779499 bnc#1086600 - Reduce hostname lookups to avoid timeouts.
Patch63:        gdm-reduce-hostname-lookups.patch
# PATCH-FIX-UPSTREAM gdm-CVE-2018-14424.patch glgo#GNOME#gdm#401 boo#1103737 CVE-2018-14424 fezhang@suse.com -- Fix use-after-free of disposed transient displays.
Patch64:        gdm-CVE-2018-14424.patch
# PATCH-FIX-SLE gdm-failed-gracefully-booting-from-snapshot.patch bsc#980337 xwang@suse.com -- gdm exits when starting from snapshot
Patch65:        gdm-failed-gracefully-booting-from-snapshot.patch
# PATCH-FIX-SLE gdm-quit-plymouth-when-xdmcp-is-the-only-allowed-connection.patch bsc#1172813 xwang@suse.com -- gdm quit plymouth when xdmcp is the only allowed connection
Patch66:        gdm-quit-plymouth-when-xdmcp-is-the-only-allowed-connection.patch
BuildRequires:  check-devel
# needed for directory ownership
BuildRequires:  dconf
BuildRequires:  gnome-common
# needed for directory ownership
BuildRequires:  gnome-session-core
BuildRequires:  gobject-introspection-devel >= 0.9.12
BuildRequires:  iso-codes-devel
BuildRequires:  libXdmcp-devel
BuildRequires:  libXi-devel
BuildRequires:  libXinerama-devel
BuildRequires:  libattr-devel
BuildRequires:  libcanberra-devel
BuildRequires:  pam-devel
BuildRequires:  pwdutils
BuildRequires:  tcpd-devel
BuildRequires:  translation-update-upstream
BuildRequires:  update-desktop-files
BuildRequires:  xorg-x11-server
BuildRequires:  xorg-x11-server-extra
BuildRequires:  pkgconfig(accountsservice)
BuildRequires:  pkgconfig(gtk+-3.0)
BuildRequires:  pkgconfig(libcanberra-gtk3)
%if %{with_systemd}
BuildRequires:  pkgconfig(libsystemd-daemon)
BuildRequires:  pkgconfig(libsystemd-journal)
BuildRequires:  pkgconfig(libsystemd-login) >= 186
%endif
BuildRequires:  pkgconfig(ply-boot-client)
BuildRequires:  pkgconfig(x11)
BuildRequires:  pkgconfig(xau)
BuildRequires:  pkgconfig(xrandr)
Requires:       %{name}-branding = %{version}
%if ! %{with_systemd}
Requires:       ConsoleKit-x11
%endif
Requires:       gdmflexiserver
Requires:       gnome-session-core
Requires:       gnome-settings-daemon
Requires:       gnome-shell
Requires:       xorg-x11-server-extra
Requires(post): dconf
# accessibility
Recommends:     orca
# For groupadd, useradd, usermod
PreReq:         pwdutils
PreReq:         %insserv_prereq
Recommends:     %{name}-lang
Recommends:     iso-codes
Provides:       gdm2 = %{version}
Obsoletes:      gdm2 < %{version}
Provides:       gnome-applets-gdm = %{version}
Obsoletes:      gnome-applets-gdm < %{version}
# gdmflexiserver is dropped since 3.5.90
Obsoletes:      gdmflexiserver < %{version}
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
DocDir:         %{_defaultdocdir}
%glib2_gsettings_schema_requires

%description
The GNOME Display Manager is a system service that is responsible for
providing graphical log-ins and managing local and remote displays.

%package -n libgdm1
Summary:        Client Library for Communicating with GDM Greeter Server
Group:          System/Libraries
Recommends:     gdm

%description -n libgdm1
The GNOME Display Manager is a system service that is responsible for
providing graphical log-ins and managing local and remote displays.

%package -n typelib-1_0-Gdm-1_0
Summary:        Client Library for Communicating with GDM Greeter Server -- Introspection bindings
Group:          System/Libraries

%description -n typelib-1_0-Gdm-1_0
The GNOME Display Manager is a system service that is responsible for
providing graphical log-ins and managing local and remote displays.

This package provides the GObject Introspection bindings for
communicating with the GDM greeter server.

%package devel
Summary:        Libraries for GDM -- Development Files
Group:          Development/Libraries/GNOME
Requires:       libgdm1 = %{version}
Requires:       typelib-1_0-Gdm-1_0 = %{version}

%description devel
The GNOME Display Manager is a system service that is responsible for
providing graphical log-ins and managing local and remote displays.

%package branding-upstream
Summary:        The GNOME Display Manager -- Upstream default configuration
Group:          System/GUI/GNOME
Requires:       %{name} = %{version}
Provides:       %{name}-branding = %{version}
Conflicts:      otherproviders(%{name}-branding)
Supplements:    packageand(%{name}:branding-upstream)
BuildArch:      noarch
#BRAND: Provide one file:
#BRAND: /etc/gdm/custom.conf
#BRAND:   Default configuration of gdm

%description branding-upstream
The GNOME Display Manager is a system service that is responsible for
providing graphical log-ins and managing local and remote displays.

This package provides the upstream default configuration for gdm.

%package -n gdmflexiserver
Summary:        Gdmflexiserver Compatibility Wrapper for Display Managers
Group:          System/GUI/GNOME
Suggests:       gdm
BuildArch:      noarch

%description -n gdmflexiserver
The gdmflexiserver tool interacts with the display manager to
enable fast user switching. This package contains a wrapper that
selects the correct gdmflexiserver implementatoin, based on the
running display manager.

%lang_package
%prep
%setup -q
translation-update-upstream
%patch3 -p1
%patch7 -p1
%patch51 -p1
%patch8 -p1
%patch9 -p1
%patch34 -p1
%patch35 -p1
%patch40 -p1
%patch41 -p1
%patch42 -p1
%patch43 -p1
%patch44 -p1
%patch45 -p1
%patch46 -p1
%patch6 -p1
%patch47 -p1
%patch48 -p1
%patch49
%patch50 -p1
%patch52 -p1
%patch53 -p1
%patch54 -p1
%patch55 -p1
%patch56 -p1
%patch57 -p1
%patch58 -p1
%patch59 -p1
%patch60 -p1
%patch61 -p1
%patch62 -p1
%patch63 -p1
%patch64 -p1
%patch65 -p1
%patch66 -p1

%build
NOCONFIGURE=1 sh %{S:8}
%configure\
        --disable-static \
        --libexecdir=%{_prefix}/lib/gdm \
        --localstatedir=%{_localstatedir} \
        --with-at-spi-registryd-directory=%{_libexecdir}/at-spi \
        --with-check-accelerated-directory=%{_libexecdir} \
        --enable-ipv6 \
        --with-plymouth \
%if %{with_systemd}
        --with-systemd \
%else
        --with-consolekit-directory=%{_libexecdir}/ConsoleKit \
        --without-systemd \
        --with-console-kit \
%endif
%if %{enable_split_authentication}
        --enable-split-authentication \
%else
        --disable-split-authentication \
%endif
        --with-initial-vt=7 \
        --with-run-dir=/run/gdm \
        --disable-systemd-journal
%__make %{?jobs:-j%jobs} V=1

%install
%make_install
find %{buildroot}%{_libdir} -name '*.la' -type f -delete -print
# Do not ship the systemd.service file: openSUSE uses xdm, which enables the DM based on sysconfig.
%if %{with_systemd}
rm %{buildroot}%{systemdsystemunitdir}/gdm.service
%endif
# dconf database, rebuilt in scriptlets; touch it for %%ghost
touch %{buildroot}%{_sysconfdir}/dconf/db/gdm
## Install PAM files.
mkdir -p $RPM_BUILD_ROOT/etc/pam.d
# Generic pam config
cp %{SOURCE1} $RPM_BUILD_ROOT/etc/pam.d/gdm
# Pam config for autologin
cp %{SOURCE2} $RPM_BUILD_ROOT/etc/pam.d/gdm-autologin
# Pam config for the greeter session
cp %{SOURCE3} $RPM_BUILD_ROOT/etc/pam.d/gdm-launch-environment
%if %{enable_split_authentication}
# Pam config for fingerprint authentication
cp %{SOURCE6} $RPM_BUILD_ROOT/etc/pam.d/gdm-fingerprint
# Pam config for smartcard authentication
cp %{SOURCE7} $RPM_BUILD_ROOT/etc/pam.d/gdm-smartcard
%endif
# The default gdm pam configuration is the one to be used as pam-password too
%if %{enable_split_authentication}
rm $RPM_BUILD_ROOT/etc/pam.d/gdm-password
echo "We are not ready for this, we need to know what to put in gdm-fingerprint and gdm-smartcard pam config files."
false
%endif
ln -s gdm $RPM_BUILD_ROOT/etc/pam.d/gdm-password
## Install other files
# Install PostLogin script.
mv $RPM_BUILD_ROOT%{_sysconfdir}/gdm/PostLogin/Default.sample $RPM_BUILD_ROOT%{_sysconfdir}/gdm/PostLogin/Default
# Move gdmflexiserver to libexecdir and replace it with the compatibility wrapper
mv $RPM_BUILD_ROOT%{_bindir}/gdmflexiserver $RPM_BUILD_ROOT%{_libexecdir}/gdm/gdmflexiserver
install -m 755 %{SOURCE4} $RPM_BUILD_ROOT%{_bindir}/gdmflexiserver
#Install /etc/xinit.d/xdm integration script
install -D -m 644 %{SOURCE5} %{buildroot}%{_libexecdir}/X11/displaymanagers/gdm
# Install other files
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/log/gdm
mkdir -p $RPM_BUILD_ROOT/run/gdm
mkdir -p $RPM_BUILD_ROOT%{_bindir}
ln -s ../sbin/gdm $RPM_BUILD_ROOT%{_bindir}/gdm
%find_lang %{name} %{?no_lang_C}

%clean
rm -rf $RPM_BUILD_ROOT

%pre
/usr/sbin/groupadd -r gdm 2> /dev/null || :
/usr/sbin/useradd -r -g gdm -G video -s /bin/false \
-c "Gnome Display Manager daemon" -d /var/lib/gdm gdm 2> /dev/null || :
/usr/sbin/usermod -g gdm -G video -s /bin/false gdm 2> /dev/null
# Fix incorrect interpretation of DISPLAYMANAGER_PASSWORD_LESS_LOGIN (#307566).
# Last done in SLED10&10.1, first fixed in 10.3.
# Can be removed after SLES12:
if test -f sbin/conf.d/SuSEconfig.gdm && grep -q gdm-autologin sbin/conf.d/SuSEconfig.gdm ; then
    if grep -q '^DISPLAYMANAGER_PASSWORD_LESS_LOGIN="no"' etc/sysconfig/displaymanager ; then
	sed 's/^\(auth[[:space:]][[:space:]]*\)include[[:space:]]\([[:space:]]*\)common-auth/\1required\2pam_permit.so/' <etc/pam.d/gdm-autologin >etc/pam.d/gdm-autologin.new
	if cmp -s etc/pam.d/gdm-autologin etc/pam.d/gdm-autologin.new ; then
	    rm etc/pam.d/gdm-autologin.new
	else
	    mv etc/pam.d/gdm-autologin.new etc/pam.d/gdm-autologin
	fi
    fi
fi
# Fix how DISPLAYMANAGER_PASSWORD_LESS_LOGIN is used. Before 11.4,
# /etc/pam.d/gdm was changed to use pam_permit. We don't want this anymore.
if test -f /sbin/conf.d/SuSEconfig.gdm; then
    grep -q pam_permit.so /etc/pam.d/gdm
    if test $? -eq 0; then
        # We'll just use the file from the new package
        mv /etc/pam.d/gdm /etc/pam.d/gdm.rpmold
    fi
fi

%post
%glib2_gsettings_schema_post
%icon_theme_cache_post

%posttrans
# Create dconf database for gdm, to lockdown the gdm session
dconf update

%postun
%insserv_cleanup
%glib2_gsettings_schema_postun
%icon_theme_cache_postun

%post -n libgdm1 -p /sbin/ldconfig

%postun -n libgdm1 -p /sbin/ldconfig

%files
%defattr(-,root,root)
%doc AUTHORS COPYING ChangeLog NEWS README
%doc %{_datadir}/help/C/%{name}/
%dir %config %{_sysconfdir}/gdm
%config %{_sysconfdir}/gdm/[IPXl]*
%{_sbindir}/gdm
%{_bindir}/gdm
%{_bindir}/gdm-screenshot
%{_datadir}/gdm/
%{_datadir}/glib-2.0/schemas/org.gnome.login-screen.gschema.xml
%{_datadir}/gnome-session/sessions/gdm-shell.session
%{_datadir}/icons/*/*/*/*.*
%{_datadir}/pixmaps/*.png
%dir %{_libexecdir}/gdm
%{_libexecdir}/gdm/gdm-*
%{_libexecdir}/gdm/gdmflexiserver
%attr(750,gdm,gdm) %dir %{_localstatedir}/lib/gdm
%attr(711,root,gdm) %dir %{_localstatedir}/log/gdm
%dir %{_localstatedir}/cache/gdm
%ghost %attr(751,gdm,gdm) %dir /run/gdm
%config /etc/pam.d/gdm
%config /etc/pam.d/gdm-autologin
%if %{enable_split_authentication}
%config /etc/pam.d/gdm-fingerprint
%config /etc/pam.d/gdm-smartcard
%endif
%config /etc/pam.d/gdm-password
%config /etc/pam.d/gdm-launch-environment
%config %{_sysconfdir}/dbus-1/system.d/gdm.conf
%dir %config %{_sysconfdir}/dconf/db/gdm.d
%dir %config %{_sysconfdir}/dconf/db/gdm.d/locks
%{_sysconfdir}/dconf/db/gdm.d/00-upstream-settings
%{_sysconfdir}/dconf/db/gdm.d/locks/00-upstream-settings-locks
%ghost %{_sysconfdir}/dconf/db/gdm
%{_sysconfdir}/dconf/profile/gdm
# /etc/xinit.d/xdm integration
%dir %{_libexecdir}/X11/displaymanagers
%{_libexecdir}/X11/displaymanagers/gdm

%files -n libgdm1
%defattr(-,root,root)
%{_libdir}/libgdm.so.*

%files -n typelib-1_0-Gdm-1_0
%defattr(-,root,root)
%{_libdir}/girepository-1.0/Gdm-1.0.typelib

%files devel
%defattr(-,root,root)
%{_includedir}/gdm/
%{_libdir}/libgdm.so
%{_libdir}/pkgconfig/gdm.pc
%{_datadir}/gir-1.0/Gdm-1.0.gir

%files branding-upstream
%defattr(-,root,root)
%config(noreplace) %{_sysconfdir}/gdm/custom.conf

%files -n gdmflexiserver
%defattr(-,root,root)
%{_bindir}/gdmflexiserver

%files lang -f %{name}.lang

%changelog