6efafb9
%global md5() {$(echo -n %1 | md5sum | awk '{print$1}')}
d3ad96f
%if 0%{?fedora} >= 38
d3ad96f
%global fedora_release_name f38
08d35bd
%else
08d35bd
%global fedora_release_name f%{?fedora}
08d35bd
%endif
d119849
d119849
Name:           deepin-wallpapers
178910e
Version:        1.7.7
d849a47
Release:        %autorelease
87d0e5a
Summary:        Deepin Wallpapers provides wallpapers of DDE
d3ad96f
# SPDX migration
d3ad96f
License:        GPL-3.0-only
d119849
URL:            https://github.com/linuxdeepin/deepin-wallpapers
6efafb9
Source0:        %{url}/archive/%{version}/%{name}-%{version}.tar.gz
d119849
BuildArch:      noarch
6efafb9
BuildRequires:  deepin-api
a0698fd
# convert default Fedora wallpaper to jpg format
a0698fd
BuildRequires:  /usr/bin/convert
a0698fd
# for the current default wallpaper
a0698fd
BuildRequires:  %{fedora_release_name}-backgrounds-base
d3ad96f
BuildRequires:  make
87d0e5a
Requires(post): %{_sbindir}/alternatives
87d0e5a
Requires(postun): %{_sbindir}/alternatives
d119849
d119849
%description
6efafb9
%{summary}.
d119849
d119849
%prep
6efafb9
%setup -q -n %{name}-%{version}
d119849
d119849
%build
a0698fd
mv deepin/desktop.jpg deepin/deepin-desktop.jpg
b16894e
convert %{_datadir}/backgrounds/%{fedora_release_name}/default/%{fedora_release_name}-01-day.png \
a0698fd
        deepin/desktop.jpg
6efafb9
%make_build
d119849
d119849
%install
6efafb9
install -d %{buildroot}%{_datadir}/wallpapers/deepin/
6efafb9
cp deepin/* deepin-private/* deepin-community/* %{buildroot}%{_datadir}/wallpapers/deepin/
d119849
6efafb9
install -d %{buildroot}%{_var}/cache/
6efafb9
cp -ar image-blur %{buildroot}%{_var}/cache/
6efafb9
6efafb9
install -d %{buildroot}%{_datadir}/backgrounds/deepin/
6efafb9
ln -sv ../../wallpapers/deepin/Hummingbird_by_Shu_Le.jpg \
6efafb9
  %{buildroot}%{_datadir}/backgrounds/deepin/desktop.jpg
6efafb9
ln -sv %{md5 %{_datadir}/wallpapers/deepin/Hummingbird_by_Shu_Le.jpg}.jpg \
6efafb9
  %{buildroot}%{_var}/cache/image-blur/%{md5 %{_datadir}/backgrounds/deepin/desktop.jpg}.jpg
d119849
87d0e5a
touch %{buildroot}%{_datadir}/backgrounds/default_background.jpg
a0698fd
a0698fd
%post
a0698fd
if [ $1 -ge 1 ]; then
a0698fd
  %{_sbindir}/alternatives --install %{_datadir}/backgrounds/default_background.jpg \
a0698fd
    deepin-default-background %{_datadir}/wallpapers/deepin/desktop.jpg 50
a0698fd
fi
Li Rui Bin 48a5e6f
87d0e5a
%postun
87d0e5a
if [ $1 -eq 0 ]; then
87d0e5a
  %{_sbindir}/alternatives --remove deepin-default-background %{_datadir}/wallpapers/deepin/desktop.jpg
87d0e5a
fi
87d0e5a
d119849
%files
d119849
%doc README.md
d119849
%license LICENSE
87d0e5a
%ghost %{_datadir}/backgrounds/default_background.jpg
6efafb9
%{_datadir}/backgrounds/deepin/
87d0e5a
%dir %{_datadir}/wallpapers
d119849
%{_datadir}/wallpapers/deepin/
d119849
%{_var}/cache/image-blur/
d119849
d119849
%changelog
d849a47
%autochangelog