File kdebase4-session.spec of Package kdebase4-session
#
# spec file for package kdebase4-session
#
# Copyright (c) 2014 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/
#
Name: kdebase4-session
Version: 4.12
Release: 0
Summary: The KDE Session
License: GPL-2.0+
Group: System/GUI/KDE
Url: http://www.kde.org/
Source1: kde-plasma.desktop
Source2: COPYING
Requires: kdebase4-workspace < 5
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Requires: update-desktop-files
Requires(pre): /usr/bin/sed /usr/bin/grep /usr/bin/cut
Requires(post): update-alternatives
Requires(postun): update-alternatives
%description
This package contains the startup scripts necessary to start a KDE
session from kdm.
%prep
%build
%install
install -m 0755 -d %{buildroot}%{_datadir}/xsessions/
cp %{SOURCE1} %{buildroot}%{_datadir}/xsessions/
install -D -m644 %{SOURCE2} %{buildroot}%{_datadir}/doc/packages/kdebase4-session/COPYING
%if 0%{?suse_version} > 1320
mkdir -p %{buildroot}%{_sysconfdir}/alternatives
touch %{buildroot}%{_sysconfdir}/alternatives/default-xsession.desktop
ln -s %{_sysconfdir}/alternatives/default-xsession.desktop %{buildroot}%{_datadir}/xsessions/default.desktop
%endif
%clean
rm -rf %{buildroot}
%post
# Reset the DEFAULT_WM value for KDE upgrade compatibility
if [ -f /etc/sysconfig/windowmanager ]; then
OLD_DEFAULTWM=`grep "DEFAULT_WM" /etc/sysconfig/windowmanager | cut -d '=' -f 2 | cut -d '"' -f 2`
fi
if [ -f /var/adm/fillup-templates/sysconfig.windowmanager ]; then
TEMPLATE_DEFAULTWM=`grep "DEFAULT_WM" /var/adm/fillup-templates/sysconfig.windowmanager | cut -d '=' -f 2 | cut -d '"' -f 2`
fi
# Check the old DEFAULT_WM and whether current DEFAULT_WM exists
if [ "$OLD_DEFAULTWM" = "startkde4" ] || [ "$OLD_DEFAULTWM" = "startkde" ] || [ "$OLD_DEFAULTWM" = "kde4" ]; then
if [ -n "$TEMPLATE_DEFAULTWM" ] && [ "$OLD_DEFAULTWM" != "$TEMPLATE_DEFAULTWM" ]; then
sed -i -e "s/^DEFAULT_WM=['\"]\?kde.*/DEFAULT_WM=\"${TEMPLATE_DEFAULTWM}\"/g" /etc/sysconfig/windowmanager
fi
fi
%if 0%{?suse_version} > 1320
%{_sbindir}/update-alternatives --install %{_datadir}/xsessions/default.desktop \
default-xsession.desktop %{_datadir}/xsessions/kde-plasma.desktop 25
%postun
[ -f %{_datadir}/xsessions/kde-plasma.desktop ] || %{_sbindir}/update-alternatives \
--remove default-xsession.desktop %{_datadir}/xsessions/kde-plasma.desktop
%endif
%files
%defattr(-,root,root)
%{_datadir}/xsessions/kde-plasma.desktop
%if 0%{?suse_version} > 1320
%ghost %{_sysconfdir}/alternatives/default-xsession.desktop
%ghost %{_datadir}/xsessions/default.desktop
%endif
%dir %{_datadir}/doc/packages/kdebase4-session
%{_datadir}/doc/packages/kdebase4-session/COPYING
%changelog