Run git-daemon as an inetd service instead of a separate daemon.
authorEvan Broder <broder@mit.edu>
Fri, 18 Dec 2009 03:07:05 +0000 (22:07 -0500)
committerEvan Broder <broder@mit.edu>
Fri, 18 Dec 2009 03:07:05 +0000 (22:07 -0500)
git-daemon doesn't run well under daemon(1), because it forks a child
(without detaching) that does all of its work, and killing the parent
doesn't kill the child.

svn path=/trunk/packages/invirt-dev/; revision=2636

debian/control
debian/invirt-dev.init
debian/invirt-dev.postinst
debian/invirt-dev.prerm

index b0fd8be..a805ef9 100644 (file)
@@ -7,6 +7,6 @@ Standards-Version: 3.7.2
 
 Package: invirt-dev
 Architecture: all
-Depends: ${shlibs:Depends}, ${misc:Depends}, dpkg-dev-el, emacs21, reprepro, apache2, postfix, screen, dh-make, fakeroot, quilt, patchutils, config-package-dev, pbuilder, equivs, invirt-base, invirt-database, remctl-server
+Depends: ${shlibs:Depends}, ${misc:Depends}, dpkg-dev-el, emacs21, reprepro, apache2, postfix, screen, dh-make, fakeroot, quilt, patchutils, config-package-dev, pbuilder, equivs, invirt-base, invirt-database, remctl-server, update-inetd, openbsd-inetd | inet-superserver
 Description: Invirt build and apt server
  This packages the build scripts and apt-repository configuration for Invirt.
index a12cac3..372d8f2 100755 (executable)
@@ -37,23 +37,12 @@ do_start()
 
     invirt-build-conf || ret=2
 
-    daemon -n invirt-dev-git-daemon -- git daemon \
-        --user=git \
-        --group=nogroup \
-        --syslog \
-        --verbose \
-        --reuseaddr \
-        --export-all \
-        --base-path=/srv/git \
-        /srv/git || ret=$?
-
     return $ret
 }
 
 do_stop()
 {
-    daemon -n invirt-dev-git-daemon --stop
-    return $?
+    :
 }
 
 do_reload()
index 7427c1f..49fe62c 100755 (executable)
@@ -26,6 +26,9 @@ case "$1" in
 ### END invirt-dev
 EOF
 
+        update-inetd --add \
+            'git\tstream\ttcp\tnowait\tgit\t/usr/bin/git\tgit daemon --inetd --syslog --verbose --export-all --base-path=/srv/git /srv/git'
+
         echo "-----"
         echo "invirt-dev: run"
         echo "  adduser --disabled-password \$user"
index c86e7d3..80d7817 100755 (executable)
@@ -19,7 +19,9 @@ set -e
 
 case "$1" in
     remove|upgrade|deconfigure)
-        perl -i.bak -ne 's%^### (BEGIN|END) invirt-dev\s*$%%m && ($skip = ($1 eq "BEGIN")); print unless $skip;' /etc/sudoers        
+        [ "$1" = "remove" ] && update-inetd --disable git
+
+        perl -i.bak -ne 's%^### (BEGIN|END) invirt-dev\s*$%%m && ($skip = ($1 eq "BEGIN")); print unless $skip;' /etc/sudoers
     ;;
 
     failed-upgrade)