Move to macros for users and service management required in Fedora 44+

This commit is contained in:
2026-05-09 23:13:28 -04:00
parent 9d2f408a1e
commit b79a88a8c3
2 changed files with 23 additions and 12 deletions
+22 -12
View File
@@ -1,4 +1,8 @@
ExclusiveArch: %{go_arches}
%{!?_sysusersdir: %global _sysusersdir %{_prefix}/lib/sysusers.d}
%if 0%{?el8}
%global debug_package %{nil}
%endif
%if 0%{?el9}
%global debug_package %{nil}
%endif
@@ -17,18 +21,20 @@ ExclusiveArch: %{go_arches}
Name: gitea
Version: 1.26.1
Release: 2%{?dist}
Release: 3%{?dist}
Summary: Gitea: Git with a cup of tea
License: MIT
URL: https://gitea.io/en-us/
Source0: https://github.com/go-gitea/gitea/releases/download/v%{version}/gitea-src-%{version}.tar.gz
Source1: gitea.sysusers
BuildRequires: git
BuildRequires: golang >= 1.26.2
BuildRequires: pam-devel
Requires(pre): /usr/bin/getent
Requires(pre): /usr/sbin/useradd
BuildRequires: systemd-rpm-macros
%{?systemd_requires}
%{?sysusers_requires_compat}
Requires: git
%description
@@ -66,20 +72,21 @@ rm -rf %{buildroot}
%{__install} -d %{buildroot}/var/log/gitea
%{__install} -p -m 0755 %{name} %{buildroot}%{_bindir}/%{name}
%{__install} -p -m 0644 contrib/systemd/gitea.service %{buildroot}/usr/lib/systemd/system/gitea.service
%{__install} -D -p -m 0644 %{SOURCE1} %{buildroot}%{_sysusersdir}/gitea.conf
%pre
getent passwd gitea > /dev/null 2>&1 || useradd -r -d /var/lib/gitea -s /bin/bash gitea
%sysusers_create_compat %{SOURCE1}
%post
if [ -x /usr/bin/systemctl ]
then
systemctl condrestart gitea
elif [ -x /usr/sbin/service ]
then
service gitea condrestart
fi
%systemd_post gitea.service
%preun
%systemd_preun gitea.service
%postun
%systemd_postun_with_restart gitea.service
%files
%license LICENSE
@@ -95,9 +102,13 @@ fi
%{_bindir}/%{name}
%attr(0644, root, root) /usr/lib/systemd/system/gitea.service
%attr(-, gitea, gitea) %config(noreplace) %{_sysconfdir}/gitea
%{_sysusersdir}/gitea.conf
%changelog
* Sat May 09 2026 Jason Rothstein
- Move to macros to manage services and users
* Tue Apr 28 2026 Jason Rothstein
- Drop EL8
@@ -107,4 +118,3 @@ fi
* Mon Apr 20 2026 Jason Rothstein
- version bump to 1.26.0
- golang >= 1.26.2
+1
View File
@@ -0,0 +1 @@
u gitea - "Gitea" /var/lib/gitea /bin/bash