Add systemd unit file for a socket-based activation of git-deamon to export the git repositories.
Fixes #10983.
Signed-off-by: Stefan Schantl stefan.schantl@ipfire.org --- git/git.nm | 23 ++++++++++++++++++++++- git/systemd/git.socket | 9 +++++++++ git/systemd/git@.service | 8 ++++++++ 3 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 git/systemd/git.socket create mode 100644 git/systemd/git@.service
diff --git a/git/git.nm b/git/git.nm index 13f05db..9ad9bbe 100644 --- a/git/git.nm +++ b/git/git.nm @@ -5,7 +5,7 @@
name = git version = 2.6.3 -release = 2 +release = 3
groups = Development/Tools url = http://git-scm.com/ @@ -114,6 +114,27 @@ packages %{gitcoredir}/git-daemon %{mandir}/man1/git-daemon* %{sharedstatedir}/git + %{unitdir}/git@.service + %{unitdir}/git.socket + end + + script postin + systemctl daemon-reload >/dev/null 2>&1 || : + end + + script preun + systemctl --no-reload disable git.socket >/dev/null 2>&1 || : + systemctl stop git.socket >/dev/null 2>&1 || : + systemctl stop git@.service >/dev/null 2>&1 || : + end + + script postun + systemctl daemon-reload >/dev/null 2>&1 || : + end + + script postup + systemctl daemon-reload >/dev/null 2>&1 || : + systemctl try-restart git.socket >/dev/null 2>&1 || : end end
diff --git a/git/systemd/git.socket b/git/systemd/git.socket new file mode 100644 index 0000000..3dec01d --- /dev/null +++ b/git/systemd/git.socket @@ -0,0 +1,9 @@ +[Unit] +Description=Git Activation Socket + +[Socket] +ListenStream=9418 +Accept=true + +[Install] +WantedBy=sockets.target diff --git a/git/systemd/git@.service b/git/systemd/git@.service new file mode 100644 index 0000000..185ff25 --- /dev/null +++ b/git/systemd/git@.service @@ -0,0 +1,8 @@ +[Unit] +Description=Git Repositories Server Daemon +Documentation=man:git-daemon(1) + +[Service] +User=nobody +ExecStart=-/usr/libexec/git-core/git-daemon --base-path=/var/lib/git --export-all --user-path=public_git --syslog --inetd --verbose +StandardInput=socket