netoik-api/netoik-api.spec

59 lines
1.4 KiB
Plaintext
Raw Normal View History

2023-01-24 17:40:54 +00:00
%undefine _missing_build_ids_terminate_build
%define debug_package %{nil}
Name: netoik-api
Version: %(make version)
Release: 1%{?dist}
Summary: Netoik rest API server
License: GPLv3
URL: https://www.netoik.io/api
Source0: %{name}-%{version}.tar.gz
2023-01-31 17:44:19 +00:00
Buildarch: x86_64
BuildRequires: make
2023-01-24 17:40:54 +00:00
%description
Netoik rest API server
%prep
%autosetup -v
%build
%make_build
%install
%make_install
%pre
2023-02-02 16:51:32 +00:00
# Create user only if not already exisiting.
2023-02-02 15:55:30 +00:00
id %{name} || useradd --no-create-home --shell=%{_sbindir}/nologin --user-group %{name}
2023-01-24 17:40:54 +00:00
%post
2023-02-02 16:51:32 +00:00
# Reload systemctl daemon and (re)start service.
2023-01-24 17:40:54 +00:00
systemctl daemon-reload
systemctl restart %{name}-server.service
2023-02-02 16:24:27 +00:00
systemctl enable %{name}-server.service
2023-01-24 17:40:54 +00:00
%preun
2023-02-02 16:51:32 +00:00
# Stop service only if uninstalling.
if [ $1 -eq 0 ]; then
systemctl disable --now %{name}-server.service
fi
2023-01-24 17:40:54 +00:00
%postun
2023-02-02 16:51:32 +00:00
# Reload systemctl daemon and remove netoik-api user only if uninstalling.
if [ $1 -eq 0 ]; then
systemctl daemon-reload
userdel %{name}
fi
2023-01-24 17:40:54 +00:00
%files
%attr(755, root, root) %dir %{_var}/%{name}
%attr(755, %{name}, %{name}) %dir %{_var}/%{name}/captcha
%attr(755, root, root) %dir %{_sysconfdir}/%{name}
%attr(644, root, root) %{_sysconfdir}/%{name}/server.conf.sample
%attr(640, root, %{name}) %config(noreplace) %{_sysconfdir}/%{name}/server.conf
2023-01-24 17:40:54 +00:00
%attr(644, root, root) %{_unitdir}/%{name}-server.service
%attr(755, root, root) %{_bindir}/%{name}-server