summaryrefslogtreecommitdiffstats
path: root/debian/git-daemon
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--debian/git-daemon-run.README.Debian31
-rw-r--r--debian/git-daemon-run.dirs1
-rw-r--r--debian/git-daemon-run.install2
-rw-r--r--debian/git-daemon-run.postinst17
-rw-r--r--debian/git-daemon-run.postrm22
-rw-r--r--debian/git-daemon-run.prerm9
-rw-r--r--debian/git-daemon-sysvinit.README.Debian31
-rw-r--r--debian/git-daemon-sysvinit.dirs1
-rw-r--r--debian/git-daemon-sysvinit.git-daemon.default15
-rw-r--r--debian/git-daemon-sysvinit.git-daemon.init138
-rw-r--r--debian/git-daemon-sysvinit.install1
-rw-r--r--debian/git-daemon-sysvinit.postinst8
-rwxr-xr-xdebian/git-daemon/log/run7
-rwxr-xr-xdebian/git-daemon/run6
14 files changed, 289 insertions, 0 deletions
diff --git a/debian/git-daemon-run.README.Debian b/debian/git-daemon-run.README.Debian
new file mode 100644
index 0000000..ffde9a6
--- /dev/null
+++ b/debian/git-daemon-run.README.Debian
@@ -0,0 +1,31 @@
+git-daemon-run for Debian
+-------------------------
+
+This package enables a git-daemon service. This allows people to use a
+git:// URL to access your repositories.
+
+After installing this package, wait five seconds for the git-daemon
+service to be picked up by runit, and check its status and logs:
+
+ sv stat git-daemon
+ cat /var/log/git-daemon/current
+
+See the sv(8) program on how to manage the service, or, alternatively,
+create a symbolic link /etc/init.d/git-daemon pointing to /usr/bin/sv to
+have an LSB compatible interface to control it:
+
+ ln -s /usr/bin/sv /etc/init.d/git-daemon
+ /etc/init.d/git-daemon status
+
+The git daemon by default looks into the directory /var/lib/git/ for
+repositories (this is configured in /etc/sv/git-daemon/run). It expects
+the repositories' .git subdirectories in that directory, symlinks
+pointing to the corresponding subdirectories in the repositories are just
+fine, e.g.:
+
+ ln -s ~pape/git/foo/.git /var/lib/git/foo.git
+
+This makes 'git-clone git://git.example.org/git/foo' to clone the foo
+repository on remote machines work.
+
+ -- Gerrit Pape <pape@smarden.org> Sun, 03 Jun 2007 09:51:53 +0000
diff --git a/debian/git-daemon-run.dirs b/debian/git-daemon-run.dirs
new file mode 100644
index 0000000..7847e85
--- /dev/null
+++ b/debian/git-daemon-run.dirs
@@ -0,0 +1 @@
+etc/sv/git-daemon/log
diff --git a/debian/git-daemon-run.install b/debian/git-daemon-run.install
new file mode 100644
index 0000000..40e5796
--- /dev/null
+++ b/debian/git-daemon-run.install
@@ -0,0 +1,2 @@
+debian/git-daemon/run etc/sv/git-daemon
+debian/git-daemon/log/run etc/sv/git-daemon/log
diff --git a/debian/git-daemon-run.postinst b/debian/git-daemon-run.postinst
new file mode 100644
index 0000000..41f6d20
--- /dev/null
+++ b/debian/git-daemon-run.postinst
@@ -0,0 +1,17 @@
+#!/bin/sh
+set -e
+
+#DEBHELPER#
+
+test "$1" = 'configure' || exit 0
+
+getent passwd gitlog >/dev/null || \
+ adduser --system --home /nonexistent --no-create-home gitlog
+getent passwd gitdaemon >/dev/null || \
+ adduser --system --home /nonexistent --no-create-home gitdaemon
+
+# enable git-daemon service
+update-service --add /etc/sv/git-daemon
+
+# restart git-daemon service if it was running
+test -z "$2" || sv -v term git-daemon || :
diff --git a/debian/git-daemon-run.postrm b/debian/git-daemon-run.postrm
new file mode 100644
index 0000000..f6aa282
--- /dev/null
+++ b/debian/git-daemon-run.postrm
@@ -0,0 +1,22 @@
+#!/bin/sh
+set -e
+
+#DEBHELPER#
+
+test "$1" = 'purge' || exit 0
+
+sv down /etc/sv/git-daemon 2>/dev/null || :
+sv down /etc/sv/git-daemon/log 2>/dev/null || :
+sv force-shutdown /etc/sv/git-daemon 2>/dev/null || :
+sv force-stop /etc/sv/git-daemon/log 2>/dev/null || :
+rm -rf /etc/sv/git-daemon/supervise /etc/sv/git-daemon/log/supervise
+rm -rf /var/lib/supervise/git-daemon /var/lib/supervise/git-daemon.log
+
+for i in '@*' current config lock state; do
+ rm -f /var/log/git-daemon/$i
+done
+rmdir /var/log/git-daemon || :
+
+getent passwd gitlog >/dev/null || exit 0
+! deluser --version >/dev/null 2>&1 || exec deluser -f gitlog
+echo 'deluser program not available, not removing system user "gitlog".' >&2
diff --git a/debian/git-daemon-run.prerm b/debian/git-daemon-run.prerm
new file mode 100644
index 0000000..0685520
--- /dev/null
+++ b/debian/git-daemon-run.prerm
@@ -0,0 +1,9 @@
+#!/bin/sh
+set -e
+
+#DEBHELPER#
+
+test "$1" = 'remove' || test "$1" = 'deconfigure' || \
+ test "$1" = 'failed-upgrade' || exit 0
+
+update-service --remove /etc/sv/git-daemon || :
diff --git a/debian/git-daemon-sysvinit.README.Debian b/debian/git-daemon-sysvinit.README.Debian
new file mode 100644
index 0000000..cea76b6
--- /dev/null
+++ b/debian/git-daemon-sysvinit.README.Debian
@@ -0,0 +1,31 @@
+git-daemon-sysvinit for Debian
+------------------------------
+
+This package enables a git-daemon service. This allows people to use a
+git:// URL to access your repositories.
+
+After installing this package, the daemon needs to be enabled in
+/etc/default/git-daemon by setting:
+
+ GIT_DAEMON_ENABLE=false
+
+to:
+
+ GIT_DAEMON_ENABLE=true
+
+After that, the git daemon can be started with:
+
+ # /etc/init.d/git-daemon start
+
+The git daemon by default looks into the directory /var/lib/git/ for
+repositories (this is configured in /etc/default/git-daemon). It expects
+the repositories' .git subdirectories in that directory, symlinks
+pointing to the corresponding subdirectories in the repositories are just
+fine, e.g.:
+
+ ln -s ~daniel/git/foo/.git /var/lib/git/foo.git
+
+This makes 'git-clone git://git.example.org/git/foo' to clone the foo
+repository on remote machines work.
+
+ -- Daniel Baumann <daniel@debian.org> Tue, 19 Oct 2010 00:54:58 +0200
diff --git a/debian/git-daemon-sysvinit.dirs b/debian/git-daemon-sysvinit.dirs
new file mode 100644
index 0000000..c0bef38
--- /dev/null
+++ b/debian/git-daemon-sysvinit.dirs
@@ -0,0 +1 @@
+usr/share/git-core/sysvinit
diff --git a/debian/git-daemon-sysvinit.git-daemon.default b/debian/git-daemon-sysvinit.git-daemon.default
new file mode 100644
index 0000000..356bb3d
--- /dev/null
+++ b/debian/git-daemon-sysvinit.git-daemon.default
@@ -0,0 +1,15 @@
+# Defaults for git-daemon initscript
+# sourced by /etc/init.d/git-daemon
+# installed at /etc/default/git-daemon by the maintainer scripts
+
+#
+# This is a POSIX shell fragment
+#
+
+GIT_DAEMON_ENABLE=false
+GIT_DAEMON_USER=gitdaemon
+GIT_DAEMON_BASE_PATH=/var/lib
+GIT_DAEMON_DIRECTORY=/var/lib/git
+
+# Additional options that are passed to the Daemon.
+GIT_DAEMON_OPTIONS=""
diff --git a/debian/git-daemon-sysvinit.git-daemon.init b/debian/git-daemon-sysvinit.git-daemon.init
new file mode 100644
index 0000000..cc98a00
--- /dev/null
+++ b/debian/git-daemon-sysvinit.git-daemon.init
@@ -0,0 +1,138 @@
+#!/bin/sh
+### BEGIN INIT INFO
+# Provides: git-daemon
+# Required-Start: $network $remote_fs $syslog
+# Required-Stop: $network $remote_fs $syslog
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: git-daemon service
+# Description: git-daemon is a simple server for git repositories,
+# ideally suited for read-only updates, i.e. pulling from
+# git repositories through the network.
+### END INIT INFO
+
+# PATH should only include /usr/* if it runs after the mountnfs.sh script
+PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/lib/git-core
+DESC="git-daemon service"
+NAME=git-daemon
+DAEMON=/usr/lib/git-core/$NAME
+PIDFILE=/var/run/$NAME.pid
+SCRIPTNAME=/etc/init.d/$NAME
+
+# Exit if the package is not installed
+[ -e /usr/share/git-core/sysvinit/sentinel ] || exit 0
+
+# Read configuration variable file if it is present
+[ -r /etc/default/$NAME ] && . /etc/default/$NAME
+
+GIT_DAEMON_USER=${GIT_DAEMON_USER:-gitdaemon}
+GIT_DAEMON_BASE_PATH=${GIT_DAEMON_BASE_PATH:-/var/lib}
+GIT_DAEMON_DIRECTORY=${GIT_DAEMON_DIRECTORY:-/var/lib/git}
+
+DAEMON_ARGS="--user=$GIT_DAEMON_USER --pid-file=$PIDFILE --detach"
+DAEMON_ARGS="$DAEMON_ARGS --reuseaddr --verbose $GIT_DAEMON_OPTIONS"
+DAEMON_ARGS="$DAEMON_ARGS --base-path=$GIT_DAEMON_BASE_PATH $GIT_DAEMON_DIRECTORY"
+
+# Load the VERBOSE setting and other rcS variables
+. /lib/init/vars.sh
+
+# Define LSB log_* functions.
+# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
+. /lib/lsb/init-functions
+
+#
+# Function that starts the daemon/service
+#
+do_start()
+{
+ # Return
+ # 0 if daemon has been started
+ # 1 if daemon was already running
+ # 2 if daemon could not be started
+ start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
+ || return 1
+ start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
+ $DAEMON_ARGS \
+ || return 2
+}
+
+#
+# Function that stops the daemon/service
+#
+do_stop()
+{
+ # Return
+ # 0 if daemon has been stopped
+ # 1 if daemon was already stopped
+ # 2 if daemon could not be stopped
+ # other if a failure occurred
+ start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
+ RETVAL="$?"
+ [ "$RETVAL" = 2 ] && return 2
+ # Many daemons don't delete their pidfiles when they exit.
+ rm -f $PIDFILE
+ return "$RETVAL"
+}
+
+case "$1" in
+ start)
+ if [ $GIT_DAEMON_ENABLE = true ]; then
+ [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC " "$NAME"
+ else
+ [ "$VERBOSE" != no ] && log_warning_msg "$NAME not enabled in /etc/default/$NAME, not starting..."
+ exit 0
+ fi
+
+ do_start
+ case "$?" in
+ 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
+ 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+ esac
+ ;;
+ stop)
+ [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
+ do_stop
+ case "$?" in
+ 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
+ 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+ esac
+ ;;
+ status)
+ status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
+ ;;
+ restart|force-reload)
+ if [ $GIT_DAEMON_ENABLE != true ]; then
+ [ "$VERBOSE" != no ] && log_warning_msg "$NAME not enabled in /etc/default/$NAME, stopping..."
+ do_stop
+ case "$?" in
+ 0|1)
+ log_end_msg 0 ;;
+ *)
+ log_end_msg 1 ;;
+ esac
+ exit
+ fi
+ log_daemon_msg "Restarting $DESC" "$NAME"
+ do_stop
+ case "$?" in
+ 0|1)
+ do_start
+ case "$?" in
+ 0) log_end_msg 0 ;;
+ 1) log_end_msg 1 ;; # Old process is still running
+ *) log_end_msg 1 ;; # Failed to start
+ esac
+ ;;
+ *)
+ # Failed to stop
+ log_end_msg 1
+ ;;
+ esac
+ ;;
+ *)
+ echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
+ exit 3
+ ;;
+esac
+
+:
diff --git a/debian/git-daemon-sysvinit.install b/debian/git-daemon-sysvinit.install
new file mode 100644
index 0000000..094c5a8
--- /dev/null
+++ b/debian/git-daemon-sysvinit.install
@@ -0,0 +1 @@
+debian/sentinel usr/share/git-core/sysvinit
diff --git a/debian/git-daemon-sysvinit.postinst b/debian/git-daemon-sysvinit.postinst
new file mode 100644
index 0000000..65270fb
--- /dev/null
+++ b/debian/git-daemon-sysvinit.postinst
@@ -0,0 +1,8 @@
+#!/bin/sh
+set -e
+
+test "$1" != 'configure' || \
+getent passwd gitdaemon >/dev/null || \
+ adduser --system --home /nonexistent --no-create-home gitdaemon
+
+#DEBHELPER#
diff --git a/debian/git-daemon/log/run b/debian/git-daemon/log/run
new file mode 100755
index 0000000..eed4ed7
--- /dev/null
+++ b/debian/git-daemon/log/run
@@ -0,0 +1,7 @@
+#!/bin/sh
+set -e
+
+LOG=/var/log/git-daemon
+
+test -d "$LOG" || mkdir -p -m2750 "$LOG" && chown gitlog:adm "$LOG"
+exec chpst -ugitlog svlogd -tt "$LOG"
diff --git a/debian/git-daemon/run b/debian/git-daemon/run
new file mode 100755
index 0000000..b865526
--- /dev/null
+++ b/debian/git-daemon/run
@@ -0,0 +1,6 @@
+#!/bin/sh
+exec 2>&1
+echo 'git-daemon starting.'
+exec chpst -ugitdaemon \
+ "$(git --exec-path)"/git-daemon --verbose --reuseaddr \
+ --base-path=/var/lib /var/lib/git