File YOURLS.spec of Package YOURLS

#
# spec file for package YOURLS
#
# Copyright (c) 2021 SUSE LLC
#
# 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/
#


Name:           YOURLS
Version:        1.9.2
Release:        0
Summary:        Your Own URL Shortener
License:        MIT
Group:          Productivity/Networking/Web/Utilities
URL:            https://yourls.org/
Source0:        https://github.com/YOURLS/YOURLS/archive/%{version}/%{name}-%{version}.tar.gz
Source1:        %{name}.conf
Source10:       https://github.com/DerSev/YOURLS-de_DE/archive/1.8/YOURLS-de_DE-1.8.tar.gz
Source90:       README.SUSE
Source99:       %{name}-rpmlintrc
Patch0:         %{name}-configpath.patch
BuildRequires:  apache-rpm-macros
BuildArch:      noarch

%description
YOURLS stands for Your Own URL Shortener.
It is a small set of PHP scripts that will allow you to run your
own URL shortening service (a la TinyURL or bitly).

%package apache2
Summary:        Apache configuration files for %{name}
Group:          Productivity/Publishing/Other
BuildRequires:  apache2
Requires:       %{name} = %{version}
Requires:       (mod_php_any >= 7.4 or php-fpm)
Requires:       apache2
Supplements:    (apache2 and %{name})

%description apache2
The %{name} Apache2 mod_php configuration files.

%prep
%setup -q -a10
%patch0 -p1
install -m644 %{SOURCE90} .

%build
# no build required

%install
install -d -m0755 %{buildroot}%{apache_serverroot}/%{name}
install -d -m0755 %{buildroot}%{_sysconfdir}/%{name}
cp -dR * %{buildroot}%{apache_serverroot}/%{name}
# install languages
rm -rf %{buildroot}%{apache_serverroot}/%{name}/YOURLS-de_DE-1.8
cp YOURLS-de_DE-1.8/de_DE* %{buildroot}%{apache_serverroot}/%{name}/user/languages/
#install YOURLS.conf to apache conf.d
install -D -m0640 %{SOURCE1} %{buildroot}%{apache_sysconfdir}/conf.d/%{name}.conf
#copy configfile to sysconfdir
install -D -m0640 %{buildroot}%{apache_serverroot}/%{name}/user/config-sample.php \
 %{buildroot}%{_sysconfdir}/%{name}
install -D -m0640 %{buildroot}%{apache_serverroot}/%{name}/user/config-sample.php \
 %{buildroot}%{_sysconfdir}/%{name}/config.php
rm -f %{buildroot}%{apache_serverroot}/%{name}/user/config-sample.php

%files
%doc README.SUSE
%license LICENSE

%files apache2
%dir %attr(0770,root,%{apache_group}) %{_sysconfdir}/%{name}
%config(noreplace) %attr(640,%{apache_user},%{apache_group}) %{_sysconfdir}/%{name}/*
%dir %{apache_sysconfdir}/conf.d
%config(noreplace) %{apache_sysconfdir}/conf.d/%{name}.conf
%dir %attr(0750,%{apache_user},%{apache_group}) %{apache_serverroot}/%{name}
%defattr(0640,%{apache_user},%{apache_group},0750)
%{apache_serverroot}/%{name}
%{apache_serverroot}/%{name}/user/languages/*

%changelog
openSUSE Build Service is sponsored by