File lxdm.spec of Package lxdm

#
# spec file for package lxdm
#
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# 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 http://bugs.opensuse.org/
#


%define _dminitdir %{_prefix}/lib/X11/displaymanagers

Name:           lxdm
Summary:        LXDE Display Manager
License:        GPL-2.0 and LGPL-2.0
Group:          System/GUI/LXDE
Version:        0.4.1
Release:        0
Url:            http://lxde.org/
Source0:        %name-%version.tar.bz2
Source1:        README.SUSE
Source2:        %{name}.pamd
Source3:        lxdm-config.desktop
Source4:        config-users.png
Source5:        lxdm
Source6:        sysconfig.lxdm
Patch0:         %{name}-0.4.0-background.patch
# PATCH-FEATURE-OPENSUSE lxdm-0.4.0-use-sysconfig.patch andrea@opensuse.org
# this patch allow lxdm to read system settings from /etc/sysconfig
Patch1:         %{name}-0.4.0-use-sysconfig.patch
Patch2:         %{name}-0.4.0-gnome-start.patch
# PATCH-FIX-OPENSUSE lxdm-0.4.0-common.patch werner@novell.com
# this patch fix bnc#586555 lxdm now use common scripts in /etc/X11/xdm
Patch4:         %{name}-0.4.0-common.patch
Patch5:         %{name}-0.4.0-fix-null-pointer-dereference.patch
# Patch needed to use current new default wallpaper location
# bnc#732671
Patch6:         %{name}-0.4.1-background-12.1.patch
Patch7:         %{name}-bnc-741454-d4e41ec.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  ConsoleKit-devel
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  fdupes
BuildRequires:  gcc
BuildRequires:  gettext-runtime
BuildRequires:  gettext-tools
BuildRequires:  gtk2-devel
BuildRequires:  intltool
BuildRequires:  iso-codes-devel
BuildRequires:  make
BuildRequires:  pam-devel
BuildRequires:  pkg-config
BuildRequires:  update-desktop-files
Requires:       desktop-data-openSUSE
Requires:       pam
PreReq:         %fillup_prereq
%if 0%{?suse_version} >= 1210
Recommends:     gnome-control-center-user-faces
%endif
Provides:       lxdm-conf = %version
Obsoletes:      lxdm-conf < %version

%description
LXDM is the future display manager of LXDE, the Lightweight X11 Desktop
environment. It is designed as a lightweight alternative to replace GDM or
KDM in LXDE distros.

%prep
%setup -q
%if 0%{?suse_version} <= 1140
%patch0 -p1
%endif
%patch1 -p1
%patch2 -p1
%patch4 -p1
%patch5 -p1
%if 0%{?suse_version} >= 1210
%patch6 -p1
%patch7 -p1
%endif

%__cp %{SOURCE1} .

%build
autoreconf -fi
%configure
%__make %{?jobs:-j%{jobs}}

%install
%makeinstall
%__mkdir_p %buildroot/%_bindir
%__mkdir_p %buildroot/%_datadir/applications
install %SOURCE3 %buildroot/%_datadir/applications/
#need by post checks
%__mkdir_p %buildroot/%_datadir/pixmaps
install %SOURCE4 %buildroot/%_datadir/pixmaps

%suse_update_desktop_file lxdm-config
%__rm %buildroot/%_sbindir/%name
%__rm -rf %buildroot/%_sysconfdir/pam.d/%name
install %SOURCE2 %buildroot/%_sysconfdir/pam.d/%name
chmod -x %buildroot/%_sysconfdir/pam.d/%name
ln -sf %_sbindir/%name-binary %buildroot/%_bindir/%name
%find_lang %name
%__mkdir_p %buildroot/%_localstatedir/run
%__mkdir_p %buildroot/%_localstatedir/lib/%name
touch %buildroot/%_localstatedir/run/%name.pid
%__mkdir_p %{buildroot}%{_dminitdir}/
%__cp %{SOURCE5} %{buildroot}%{_dminitdir}/
%__mkdir -p %{buildroot}%{_localstatedir}/adm/fillup-templates
cp %{SOURCE6} %{buildroot}%{_localstatedir}/adm/fillup-templates/

%fdupes -s  %buildroot/%_datadir

%pre
/usr/sbin/groupadd -r lxdm 2> /dev/null || :
/usr/sbin/useradd -r -g lxdm -s /bin/false \
-c "LXDE Display Manager daemon" -d /var/lib/lxdm lxdm 2> /dev/null || :
/usr/sbin/usermod -g lxdm -G lxdm -s /bin/false lxdm 2> /dev/null

# this is only needed on initial upgrades becuase of the "noreplace"
# option into files section

%post
chmod 640 %_sysconfdir/%name/%name.conf
chown lxdm:lxdm %_sysconfdir/%name/%name.conf
%{fillup_only -ns displaymanager lxdm}

%files -f %name.lang
%defattr (-,root,root,-)
%doc AUTHORS README COPYING README.SUSE
%dir %{_datadir}/%{name}/
%{_datadir}/applications/lxdm-config.desktop
%{_datadir}/%{name}/*
%dir %{_sysconfdir}/%{name}/
%dir %{_dminitdir}/
%{_bindir}/%{name}
%{_bindir}/%{name}-config
%{_sbindir}/%{name}-binary
%{_libexecdir}/%{name}-greeter-gtk
%{_libexecdir}/%{name}-greeter-gdk
%{_libexecdir}/%{name}-numlock
%config(noreplace) %{_sysconfdir}/%{name}/Xsession
%config(noreplace) %{_sysconfdir}/%{name}/PreReboot
%config(noreplace) %{_sysconfdir}/%{name}/PreShutdown
%config(noreplace) %{_sysconfdir}/%{name}/PreLogin
%config(noreplace) %{_sysconfdir}/%{name}/PostLogin
%config(noreplace) %{_sysconfdir}/%{name}/PostLogout
%config(noreplace) %{_sysconfdir}/%{name}/LoginReady
%attr(640,lxdm,lxdm) %config(noreplace) %{_sysconfdir}/%{name}/%{name}.conf
%config(noreplace) %{_sysconfdir}/pam.d/%{name}
%attr(750,lxdm,lxdm) %dir %{_localstatedir}/lib/%{name}
%ghost %{_localstatedir}/run/%{name}.pid
%exclude /%_datadir/pixmaps
%{_dminitdir}/lxdm
%config %{_localstatedir}/adm/fillup-templates/sysconfig.lxdm

%changelog
openSUSE Build Service is sponsored by