File matomo-plugin-LoginOIDC.spec of Package matomo-plugin-LoginOIDC

#
# spec file for package matomo-plugin-LoginOIDC
#
# Copyright (c) 2024 SUSE LLC
# Copyright (c) 2024 Georg Pfuetzenreuter
#
# 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         real_name LoginOIDC
%define         matomo_dir /srv/www/matomo
%define         matomo_plugindir %{matomo_dir}/plugins
Name:           matomo-plugin-LoginOIDC
Version:        5.0.0
Release:        0
Summary:        Matomo OIDC login plugin
License:        GPL-3.0-or-later
Group:          Productivity/Networking/Web/Utilities
URL:            https://plugins.matomo.org/LoginOIDC
Source:         %{version}.zip
Patch0:         gh-pr-82_hidepasswordlogin.patch
Patch1:         gh-pr-116_piwikauth.patch
BuildRequires:  fdupes
BuildRequires:  matomo
BuildRequires:  unzip
BuildArch:      noarch

%description
Easily add a "Login with GitHub" button your Matomo instance. You can also setup any other service to do the authentication for you.

%prep
%autosetup -n %{real_name} -p 1

%build

%install
mkdir -p %{buildroot}%{matomo_plugindir}/%{real_name}
cp -a * %{buildroot}%{matomo_plugindir}/%{real_name}/
%fdupes  %{buildroot}%{matomo_plugindir}/%{real_name}

%post
# First installation: enable the plugin directly
if [ $1 -eq 1 ]; then
if [ -e %{matomo_dir}/console ]; then
  su wwwrun -s /bin/sh -c "%{_bindir}/php %{matomo_dir}/console plugin:activate %{real_name}"
fi
fi

%postun
# De-installation: disable the plugin directly
if [ $1 -eq 0 ]; then
if [ -e %{matomo_dir}/console ]; then
 su wwwrun -s /bin/sh -c "%{_bindir}/php %{matomo_dir}/console plugin:deactivate %{real_name}"
fi
fi

%files
%doc *.md
%license LICENSE
%dir %{matomo_plugindir}/%{real_name}
%{matomo_plugindir}/%{real_name}/*

%changelog
openSUSE Build Service is sponsored by