File plasma5-session.spec of Package plasma5-session
#
# spec file for package plasma5-session
#
# Copyright (c) 2016 SUSE LINUX 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:           plasma5-session
Version:        5.8.2
Release:        0
Summary:        The KDE Session
License:        GPL-2.0+
Group:          System/GUI/KDE
Url:            http://www.kde.org/
Source1:        plasma5.desktop
Source2:        COPYING
Source3:        kde-plasma.desktop
Source4:        plasmawayland.desktop
BuildRequires:  kf5-filesystem
Requires:       breeze >= %{version}
Requires:       breeze4-style >= %{version}
Requires:       breeze5-decoration >= %{version}
# needed for displaying the handbooks of KDE applications in a Plasma5 session (boo#980068)
Requires:       khelpcenter5
Requires:       khotkeys5 >= %{version}
Requires:       kwin5 >= %{version}
Requires:       libkscreen2-plugin >= %{version}
Requires:       plasma-nm5 >= %{version}
Requires:       plasma5-desktop >= %{version}
Requires:       plasma5-workspace >= %{version}
Requires:       polkit-kde-agent-5 >= %{version}
Requires:       powerdevil5 >= %{version}
Requires:       systemsettings5 >= %{version}
%if 0%{?suse_version} > 1314 && "%{suse_version}" != "1320"
Provides:       kdebase4-session = %{version}
Obsoletes:      kdebase4-session < %{version}
%endif
BuildArch:      noarch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Requires:       update-desktop-files
Requires(pre):  /usr/bin/sed /usr/bin/grep /usr/bin/cut
%description
This package contains the startup scripts necessary to start a KDE
session from kdm.
%package wayland
Summary:        The KDE Wayland session
Group:          System/GUI/KDE
Requires:       %{name} >= %{version}
Requires:       kwayland-integration >= %{version}
Requires:       libqt5-qtwayland
Requires:       xf86-input-libinput
Requires:       xorg-x11-server-wayland
%description wayland
This package contains the startup scripts necessary to start a KDE
session from display managers.
%prep
%build
%install
install -m 0755 -d %{buildroot}%{_datadir}/xsessions/
# Leap 42.1 doesn't have XWayland
%if 0%{?suse_version} > 1320
install -m 0755 -d %{buildroot}%{_datadir}/wayland-sessions/
%endif
# write version number into plasma5.desktop, this is displayed by KInfocenter as Plasma version
echo "X-KDE-PluginInfo-Version=%{version}" >> %{SOURCE1}
echo "X-KDE-PluginInfo-Version=%{version}" >> %{SOURCE4}
cp %{SOURCE1} %{buildroot}%{_datadir}/xsessions/
# Leap 42.1 doesn't have XWayland
%if 0%{?suse_version} > 1320
cp %{SOURCE4} %{buildroot}%{_datadir}/wayland-sessions/
%endif
%if 0%{?suse_version} > 1314 && "%{suse_version}" != "1320"
echo "X-KDE-PluginInfo-Version=%{version}" >> %{SOURCE3}
cp %{SOURCE3} %{buildroot}%{_datadir}/xsessions/
%endif
install -D -m644 %{SOURCE2} %{buildroot}%{_datadir}/doc/packages/plasma5-session/COPYING
# Leap 42.1 doesn't have XWayland
%if 0%{?suse_version} > 1320
install -D -m644 %{SOURCE2} %{buildroot}%{_datadir}/doc/packages/plasma5-session-wayland/COPYING
%endif
%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
%files
%defattr(-,root,root)
%{_datadir}/xsessions/plasma5.desktop
%if 0%{?suse_version} > 1314 && "%{suse_version}" != "1320"
%{_datadir}/xsessions/kde-plasma.desktop
%endif
%dir %{_datadir}/doc/packages/plasma5-session
%{_datadir}/doc/packages/plasma5-session/COPYING
# Leap 42.1 doesn't have XWayland
%if 0%{?suse_version} > 1320
%files wayland
%{_datadir}/wayland-sessions/plasmawayland.desktop
%dir %{_datadir}/wayland-sessions/
%dir %{_datadir}/doc/packages/plasma5-session-wayland
%{_datadir}/doc/packages/plasma5-session-wayland/COPYING
%endif
%changelog