From 869bdab7c1f7af9dda4d35123f93262ae994c182349df004bad43ac42fc37dc4 Mon Sep 17 00:00:00 2001 From: Dominique Leuenberger Date: Sun, 18 Apr 2021 19:44:54 +0000 Subject: [PATCH] Accepting request 885634 from devel:tools:scm OBS-URL: https://build.opensuse.org/request/show/885634 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/git?expand=0&rev=262 --- git-daemon.conf | 3 +++ git.changes | 5 +++++ git.spec | 33 ++++++++++++++++++++++++++++----- 3 files changed, 36 insertions(+), 5 deletions(-) create mode 100644 git-daemon.conf diff --git a/git-daemon.conf b/git-daemon.conf new file mode 100644 index 0000000..51851df --- /dev/null +++ b/git-daemon.conf @@ -0,0 +1,3 @@ +# Type Name ID GECOS [HOME] +u git-daemon - "git daemon" /var/lib/empty /bin/false +m git-daemon nogroup diff --git a/git.changes b/git.changes index 07213dd..eb555b8 100644 --- a/git.changes +++ b/git.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Fri Apr 9 11:34:14 UTC 2021 - Frederic Crozat + +- Add sysusers file to create git-daemon user. + ------------------------------------------------------------------- Thu Apr 8 11:29:40 UTC 2021 - Dirk Müller diff --git a/git.spec b/git.spec index 002205b..9578865 100644 --- a/git.spec +++ b/git.spec @@ -52,6 +52,7 @@ Source7: https://www.kernel.org/pub/software/scm/git/%{name}-%{version}.t Source8: %{name}.keyring Source9: %{name}-gui.desktop Source10: %{name}-gui.png +Source11: git-daemon.conf # PATCH-FIX-SUSE: Default to builtin add -i mode to avoid perl dependency Patch2: suse-use-builtin-add-interactive.patch Patch3: completion-wordbreaks.diff @@ -73,6 +74,10 @@ BuildRequires: perl-Error BuildRequires: perl-MailTools BuildRequires: python3-base BuildRequires: systemd-rpm-macros +%if 0%{?suse_version} >= 1500 +BuildRequires: system-user-nobody +BuildRequires: sysuser-tools +%endif BuildRequires: tcsh BuildRequires: update-desktop-files BuildRequires: xz @@ -241,14 +246,16 @@ Email interface for the GIT version control system. %package daemon Summary: Simple Server for Git Repositories Group: Development/Tools/Version Control -Requires: git-core = %{version} -Requires(pre): %fillup_prereq +%if 0%{?suse_version} >= 1550 +Requires(pre): group(nobody) +%sysusers_requires +%{?systemd_requires} +%else Requires(pre): %{_sbindir}/useradd Requires(pre): shadow -%{?systemd_requires} -%if 0%{?suse_version} >= 1500 -Requires(pre): group(nogroup) %endif +Requires: git-core = %{version} +Requires(pre): %fillup_prereq %description daemon A really simple TCP git daemon. In the default configuration it allows @@ -346,6 +353,10 @@ chmod 755 .make %endif ./.make -C contrib/subtree/ +%if 0%{?suse_version} >= 1500 +%sysusers_generate_pre %{SOURCE11} git-daemon +%endif + %install ./.make install %{!?_without_docs: install-doc} ### git-web @@ -427,6 +438,11 @@ install -d -m 755 %{buildroot}%{_datadir}/pixmaps install -m 644 %{SOURCE10} %{buildroot}%{_datadir}/pixmaps %suse_update_desktop_file %{buildroot}%{_datadir}/applications/%{name}-gui.desktop +%if 0%{?suse_version} >= 1500 +mkdir -p %{buildroot}%{_sysusersdir} +install -m 0644 %{SOURCE11} %{buildroot}%{_sysusersdir}/ +%endif + %find_lang %{name} cat %{name}.lang >>bin-man-doc-files # use symlinks instead of hardlinks in sub-commands @@ -435,10 +451,14 @@ cat %{name}.lang >>bin-man-doc-files %check ./.make %{?_smp_mflags} test +%if 0%{?suse_version} >= 1500 +%pre daemon -f git-daemon.pre +%else %pre daemon if ! %{_bindir}/getent passwd git-daemon >/dev/null; then %{_sbindir}/useradd -r -d %{_localstatedir}/lib/empty -s /bin/false -c "git daemon" -g nogroup git-daemon fi +%endif %service_add_pre git-daemon.service %post daemon @@ -502,6 +522,9 @@ fi %if 0%{?SuSEfirewall2} %config %{_fwdefdir}/* %endif +%if 0%{?suse_version} >= 1500 +%{_sysusersdir}/git-daemon.conf +%endif %files -n gitk %{_bindir}/gitk