File nextcloud-apps-previewgenerator.spec of Package nextcloud-apps-previewgenerator

#
# spec file for package nextcloud-apps-previewgenerator
#
# Copyright (c) 2019 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 https://bugs.opensuse.org/
#


%define app_name previewgenerator
Name:           nextcloud-apps-%{app_name}
Version:        5.10.0
Release:        0
#
Summary:        Nextcloud Apps - previewgenerator
License:        AGPL-3.0-only
Group:          Productivity/Networking/Web/Utilities
URL:            https://apps.nextcloud.com/apps/previewgenerator
Source0:        https://github.com/rullzer/previewgenerator/releases/download/v%{version}/%{app_name}-v%{version}.tar.gz
# TODO: Make use of apparmor
Source1:        %{name}-cron.apparmor
Source2:        %{name}-cron.service
Source3:        %{name}-cron.timer
BuildRequires:  apparmor-rpm-macros
BuildRequires:  nextcloud >= 18
BuildRequires:  nextcloud-packaging >= 16
%requires_ge nextcloud
BuildArch:      noarch

%description
Nextcloud app that allows admins to pre-generate previews. The app listens to
edit events and stores this information. Once a cron job is triggered it will
start preview generation. This means that you can better utilize your system by
pre-generating previews when your system is normally idle and thus putting less
load on your machine when the requests are actually served.

The app does not replace on demand preview generation so if a preview is
requested before it is pre-generated it will still be shown.

%prep
%setup -n %{app_name}

%nextcloud_apps_install %{app_name}
install -D -m 644 %{S:2} %{buildroot}%{_unitdir}/%{name}-cron.service
install -D -m 644 %{S:3} %{buildroot}%{_unitdir}/%{name}-cron.timer

%pre
%service_add_pre %{name}-cron.service %{name}-cron.socket 

%nextcloud_apps_post %{app_name}
%service_add_post %{name}-cron.service %{name}-cron.socket 

%preun
%service_del_preun %{name}-cron.service %{name}-cron.socket 

%postun
%service_del_postun %{name}-cron.service %{name}-cron.socket 

%nextcloud_apps_files %{app_name}
%{_unitdir}/%{name}-cron.service
%{_unitdir}/%{name}-cron.timer

%changelog
openSUSE Build Service is sponsored by