]> git.ipfire.org Git - people/arne_f/ipfire-3.x.git/commitdiff
git: Add systemd file for git-daemon
authorStefan Schantl <stefan.schantl@ipfire.org>
Fri, 13 Jan 2017 11:52:31 +0000 (12:52 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 16 Jan 2017 16:46:39 +0000 (16:46 +0000)
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>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
git/git.nm
git/systemd/git.socket [new file with mode: 0644]
git/systemd/git@.service [new file with mode: 0644]

index 13f05db4776f094b313a50cadcecb734d4d9cc4e..9ad9bbefb420e1688ddc3d19dbf47a4b8d927559 100644 (file)
@@ -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 (file)
index 0000000..3dec01d
--- /dev/null
@@ -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 (file)
index 0000000..185ff25
--- /dev/null
@@ -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