From b79a88a8c354f4a744d58f465bfe62b377d62758 Mon Sep 17 00:00:00 2001 From: Jason Rothstein Date: Sat, 9 May 2026 23:13:28 -0400 Subject: [PATCH] Move to macros for users and service management required in Fedora 44+ --- gitea.spec | 34 ++++++++++++++++++++++------------ gitea.sysusers | 1 + 2 files changed, 23 insertions(+), 12 deletions(-) create mode 100644 gitea.sysusers diff --git a/gitea.spec b/gitea.spec index 614e298..1c92eb6 100644 --- a/gitea.spec +++ b/gitea.spec @@ -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 - diff --git a/gitea.sysusers b/gitea.sysusers new file mode 100644 index 0000000..7bba512 --- /dev/null +++ b/gitea.sysusers @@ -0,0 +1 @@ +u gitea - "Gitea" /var/lib/gitea /bin/bash \ No newline at end of file