File branding-SLE.spec of Package branding-SLE

#
# spec file for package branding-SLE
#
# 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:           branding-SLE
Version:        12
Release:        0
Provides:       branding
Conflicts:      otherproviders(branding)
Url:            http://github.com/openSUSE/branding
Source0:        SLE.tar.xz
Source1:        distributor.svg
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%ifarch x86_64 %ix86
%define package_gfxboot 1
BuildRequires:  gfxboot-devel
%endif
%ifarch aarch64 %{ix86} x86_64 ppc ppc64 ppc64le
%define package_grub2_theme 1
%endif
Summary:        SLE Brand File
License:        BSD-3-Clause
Group:          System/Fhs
BuildRequires:  fdupes
BuildRequires:  fribidi
BuildRequires:  update-desktop-files
BuildArch:      noarch

%description
This package contains the file /etc/SUSE-brand, and its name is used as
a trigger for installation of correct vendor brand packages.

%define theme_name SLE

%if 0%{?package_gfxboot} > 0

%package        -n gfxboot-branding-SLE
Summary:        Graphical bootloader SLE theme
License:        BSD-3-Clause
Group:          System/Boot
PreReq:         gfxboot >= 4
Supplements:    packageand(gfxboot:branding-SLE)
Provides:       gfxboot-branding = %{version}
Provides:       gfxboot-theme = %{version}
Conflicts:      otherproviders(gfxboot-branding)
BuildArch:      noarch
Obsoletes:      gfxboot-branding-SLED < 12
Obsoletes:      gfxboot-branding-SLES < 12

%description -n gfxboot-branding-SLE
SLE theme for gfxboot (graphical bootloader for grub).
%endif

%package -n wallpaper-branding-SLE
Summary:        SLE default wallpapers
License:        BSD-3-Clause
Group:          System/Fhs
Requires(post): update-alternatives
Requires(postun): update-alternatives
Provides:       wallpaper-branding = %{version}
Conflicts:      otherproviders(wallpaper-branding)
BuildArch:      noarch

%description -n wallpaper-branding-SLE
SLE 12 defaults wallpapers

%package -n dynamic-wallpaper-branding-SLE
Summary:        Dynamic wallpaper for GNOME, with SLE look
License:        BSD-3-Clause
Group:          System/GUI/GNOME
Requires(post): update-alternatives
Requires(postun): update-alternatives
Supplements:    packageand(wallpaper-branding-SLE:gnome-settings-daemon)
Provides:       dynamic-wallpaper-branding = %{version}
Conflicts:      otherproviders(dynamic-wallpaper-branding)
# Used to live in gconf2-branding-SLE, with a different name, up to version 11.4 (included)
Provides:       SLE-dynamic-wallpaper = %{version}
Obsoletes:      SLE-dynamic-wallpaper < %{version}
# Old name, until SLE 11.3 (included)
Provides:       desktop-data-SLE-extra-gnome = %{version}
Obsoletes:      desktop-data-SLE-extra-gnome < %{version}
BuildArch:      noarch

%description -n dynamic-wallpaper-branding-SLE
This package contains a dynamic wallpaper with SLE look.

A dynamic wallpaper changes depending on the time of the day: it is
generally bright during the day, and dark during the night.

%package -n yast2-qt-branding-SLE
Summary:        SLE branding for yast2-qt
License:        BSD-3-Clause
Group:          System/Fhs
Provides:       yast2-qt-branding = %{version}
Conflicts:      otherproviders(yast2-qt-branding)
Supplements:    packageand(yast2-qt:branding-SLE)
BuildArch:      noarch

%description -n yast2-qt-branding-SLE
SLE 12 branding and themes for yast2-qt

%if 0%{?package_grub2_theme} > 0

%package -n grub2-branding-SLE
Summary:        SLE branding for GRUB2's graphical console
License:        CC-BY-SA-3.0
Group:          System/Fhs
Requires:       grub2
Provides:       grub2-branding = %{version}
Supplements:    packageand(grub2:branding-SLE)
Conflicts:      otherproviders(grub2-branding)
BuildArch:      noarch

%description -n grub2-branding-SLE
SLE 12 branding for the GRUB2's graphical console

%endif

%package -n plymouth-branding-SLE
Summary:        SLE branding for Plymouth bootsplash
License:        GPL-2.0+
Group:          System/Fhs
Requires:       plymouth-plugin-label
PreReq:         plymouth-plugin-script
PreReq:         plymouth-scripts
Supplements:    packageand(plymouth:branding-SLE)
Provides:       plymouth-branding = %{version}
Conflicts:      otherproviders(plymouth-branding)
BuildArch:      noarch

%description -n plymouth-branding-SLE
SLE 12 branding for the plymouth bootsplash

%package -n gdm-branding-SLE
Summary:        SLE branding for gdm
License:        GPL-2.0+
Group:          System/GUI/GNOME
# To be in sync with upstream defaults, do branding as a patch for upstream file.
# WARNING: As this package conflicts with gdm-branding-openSUSE, you cannot
#          reuse build root. You have to build in a clean build root every time!
BuildRequires:  gdm-branding-upstream
# For directory ownership:
BuildRequires:  gdm
%define gdm_version %(rpm -q --qf '%%{version}' gdm)
Requires:       gdm = %{gdm_version}
Requires:       gdm = %{gdm_version}
Provides:       gdm-branding = %{gdm_version}
Conflicts:      otherproviders(gdm-branding)
Supplements:    packageand(gdm:branding-openSUSE)
BuildArch:      noarch

%description -n gdm-branding-SLE
SLE 12 branding for the gdm

%prep
%setup -q -c
cp -a SLE/LICENSE COPYING
cp -a %{_sysconfdir}/gdm/custom.conf .

%build
cat >SUSE-brand <<EOF
SLE
VERSION = %{version}
EOF

%if 0%{?package_gfxboot} > 0
mkdir gfx
cp -a /usr/share/gfxboot/themes/openSUSE/ gfx/SLE
list=`cd SLE/gfxboot && find -type f`
for i in $list; do
  cp SLE/gfxboot/$i gfx/SLE/$i
done
pushd gfx/SLE
sed -i -e "s,product=.*,product=SUSE Linux Enterprise 12," config
sed -i -e "s,penguin=.*,penguin=0," src/gfxboot.cfg

export PATH=/usr/sbin:$PATH
make
popd
%endif

%install
mkdir -p %{buildroot}%{_sysconfdir}
cp SUSE-brand %{buildroot}%{_sysconfdir}/

mkdir -p %{buildroot}%{_datadir}/gdm/greeter/images/
install -d %{buildroot}%{_sysconfdir}/gdm
install -m0644 custom.conf %{buildroot}%{_sysconfdir}/gdm/custom.conf
cp %SOURCE1 %{buildroot}%{_datadir}/gdm/greeter/images/

# gfxboot themes will soon get a make install - promised by snwint
# gfxboot should use a link /etc/bootsplash/theme -> /usr/share/bootsplash
# like splashy 
if test -f gfx/SLE/bootlogo; then
    install -d -m 755 %{buildroot}/etc/bootsplash/themes/SLE/{bootloader,cdrom}
    cp gfx/SLE/bootlogo %{buildroot}/etc/bootsplash/themes/SLE/cdrom
    /usr/share/gfxboot/bin/unpack_bootlogo %{buildroot}/etc/bootsplash/themes/SLE/cdrom
    install -m 644 gfx/SLE/{message,po/*.tr,help-boot/*.hlp} %{buildroot}/etc/bootsplash/themes/SLE/bootloader
    /usr/share/gfxboot/bin/2hl --link --quiet %{buildroot}/etc/bootsplash/themes/SLE/*
    mkdir %{buildroot}/boot 
    touch %{buildroot}/boot/message 
fi

make -C SLE install DESTDIR=%{buildroot}
rm -rf %{buildroot}%{_datadir}/kde4/apps
rm -rf %{buildroot}%{_datadir}/gimp

for i in %{buildroot}/usr/share/wallpapers/*.desktop; do
    %suse_update_desktop_file "$i"
done
%suse_update_desktop_file %{buildroot}/usr/share/wallpapers/SLEdefault/metadata.desktop
# Touch the file handled with update-alternatives
touch %{buildroot}/usr/share/wallpapers/SLE-default.xml

# try how far we get without them
rm -v %{buildroot}/usr/share/wallpapers/SLE*desktop %{buildroot}/usr/share/wallpapers/SLE*jpg %{buildroot}/usr/share/wallpapers/default*
%fdupes %{buildroot}/usr/share/backgrounds

# remove 
rm %{buildroot}/usr/share/pixmaps/xfce4-splash-*.png
%if 0%{?package_grub2_theme} < 1
rm -rf %{buildroot}/%{_datadir}/grub2
%endif

%check
make -C SLE check DESTDIR=%{buildroot}

%if 0%{?package_gfxboot} > 0

%post -n gfxboot-branding-SLE
gfxboot --update-theme SLE
%endif

%post -n wallpaper-branding-SLE
update-alternatives --install /usr/share/wallpapers/SLE-default.xml SLE-default.xml /usr/share/wallpapers/SLE-default-static.xml 5

%postun -n wallpaper-branding-SLE
# Note: we don't use "$1 -eq 0", to avoid issues if the package gets renamed
if [ ! -f /usr/share/wallpapers/SLE-default-static.xml ]; then
  update-alternatives --remove SLE-default.xml /usr/share/wallpapers/SLE-default-static.xml
fi

%post -n dynamic-wallpaper-branding-SLE
update-alternatives --install /usr/share/wallpapers/SLE-default.xml SLE-default.xml /usr/share/wallpapers/SLE-default-dynamic.xml 10

%postun -n dynamic-wallpaper-branding-SLE
# Note: we don't use "$1 -eq 0", to avoid issues if the package gets renamed
if [ ! -f /usr/share/wallpapers/SLE-default-dynamic.xml ]; then
  update-alternatives --remove SLE-default.xml /usr/share/wallpapers/SLE-default-dynamic.xml
fi

%if 0%{?package_grub2_theme} > 0
%post -n grub2-branding-SLE
%{_datadir}/grub2/themes/%theme_name/activate-theme
if test -e /boot/grub2/grub.cfg ; then
  /usr/sbin/grub2-mkconfig -o /boot/grub2/grub.cfg || true
fi

%postun -n grub2-branding-SLE
if [ $1 = 0 ] ; then
  rm -rf /boot/grub2/themes/%theme_name
fi
%endif

%post -n plymouth-branding-SLE
export LIB=%{_libdir}
OTHEME="$(%{_sbindir}/plymouth-set-default-theme)"
if [ "$OTHEME" == "text" -o "$OTHEME" == "SLE" -o "$OTHEME" == "basedonopensuse" ]; then
   if [ ! -e /.buildenv ]; then
     %{_sbindir}/plymouth-set-default-theme -R SLE
   else
     %{_sbindir}/plymouth-set-default-theme SLE
   fi 
fi

%postun -n plymouth-branding-SLE
if [ $1 -eq 0 ]; then
    export LIB=%{_libdir}
    if [ "$(%{_sbindir}/plymouth-set-default-theme)" == "SLE" ]; then
        %{_sbindir}/plymouth-set-default-theme -R --reset
    fi
fi

%files
%defattr(-,root,root)
%doc COPYING
%{_sysconfdir}/SUSE-brand

%if 0%{?package_gfxboot} > 0

%files -n gfxboot-branding-SLE
%defattr(-,root,root)
%{_sysconfdir}/bootsplash
%ghost /boot/message
%endif

%files -n wallpaper-branding-SLE
%defattr(-,root,root)
%doc COPYING
%ghost /usr/share/wallpapers/SLE-default.xml
/usr/share/gnome-background-properties/wallpaper-branding-SLE.xml
/usr/share/wallpapers/
# File from dynamic-wallpaper-branding-SLE:
%exclude /usr/share/wallpapers/SLE-default-dynamic.xml
# FIXME: It should be owned by a different package:
%dir /usr/share/gnome-background-properties/

%files -n dynamic-wallpaper-branding-SLE
%defattr(-,root,root)
%doc COPYING
## WARNING WARNING WARNING
# If we ever remove the dynamic background, then the
# SLE-default-dynamic.xml file should still be shipped, as a symlink to
# SLE-default-static.xml. Else, we break the wallpaper configuration for
# some users.
## WARNING WARNING WARNING
# Ugly wildcard, but this way we don't have to update anything on name change
%{_datadir}/backgrounds/*/
%{_datadir}/gnome-background-properties/dynamic-wallpaper-branding-SLE.xml
%dir %{_datadir}/wallpapers
%ghost %{_datadir}/wallpapers/SLE-default.xml
%{_datadir}/wallpapers/SLE-default-dynamic.xml
# FIXME: Should be owned by a different package:
%dir %{_datadir}/backgrounds
%dir %{_datadir}/gnome-background-properties

%files -n yast2-qt-branding-SLE
%defattr(-,root,root)
%dir /usr/share/YaST2
%dir /usr/share/YaST2/theme
%dir /usr/share/YaST2/theme/SLE
/usr/share/YaST2/theme/SLE/wizard

%if 0%{?package_grub2_theme} > 0
%files -n grub2-branding-SLE
%defattr(-,root,root)
%{_datadir}/grub2
%dir /boot/grub2
%dir /boot/grub2/backgrounds
%dir /boot/grub2/themes
%ghost /boot/grub2/backgrounds/SLE
%ghost /boot/grub2/themes/SLE
%endif

%files -n plymouth-branding-SLE
%defattr(-, root, root)
%{_datadir}/plymouth/themes/SLE/

%files -n gdm-branding-SLE
%defattr (-, root, root)
%config(noreplace) %{_sysconfdir}/gdm/custom.conf
%{_datadir}/gdm/greeter/images/distributor.svg
%dir %{_datadir}/gdm/greeter/images/

%changelog
openSUSE Build Service is sponsored by