Julian Gilbey wrote:
> On Sun, May 19, 2013 at 12:49:08PM -0700, Jonathan Nieder wrote:

>> Maybe that suggests a way to make a smooth transition:
>> 
>>  1. preinst installs symlinks /var/lib/git/* -> /var/cache/git/*
>>  2. updated conffiles refer to /var/lib/git
>>  3. NEWS.Debian helps admins move the data to /var/lib/git
>
> That could work, indeed.

Ok, let's do that.  A more complete automatic migration can always be
built on top of this later if someone writes the scripts for it.

> Though I would recommend /srv/git instead of /var/lib/git, as that is
> the directory recommended by the git documentation.

The FHS says

        The methodology used to name subdirectories of /srv is
        unspecified as there is currently no consensus on how this
        should be done. One method for structuring data under /srv is
        by protocol, eg.  ftp, rsync, www, and cvs. On large systems
        it can be useful to structure /srv by administrative context,
        such as /srv/physics/www, /srv/compsci/cvs, etc. This setup
        will differ from host to host.  Therefore, no program should
        rely on a specific subdirectory structure of /srv existing or
        data necessarily being stored in /srv.

which makes /srv/git a reasonable example for the documentation but
not something I can set up in the packaging.  Users can always switch
to that on their on systems, though.

Here's a rough patch for step 1.  Step 2 would be to make preinst
automatically create the appropriate symlinks to save most sysadmins
from the trouble of having to do anything to keep their system
working.  Completely untested.

Thanks again for your help so far.

diff --git i/debian/changelog w/debian/changelog
index 86f8f8e0..03c5ff78 100644
--- i/debian/changelog
+++ w/debian/changelog
@@ -1,3 +1,21 @@
+git (1:1.8.3~rc3-1.1) experimental; urgency=low
+
+  * use /var/lib/git instead of /var/cache/git as default git
+    project root to comply with the Filesystem Hierarchy Standard
+    (thx Julian Gilbey; closes: #483788):
+    * git-daemon.default, git-daemon.in, git-daemon/run: use
+      base path of /var/lib and projectroot of /var/lib/git.
+    * gitweb.conf: $projectroot = "/var/lib/git".
+    * rules: package git: install empty /var/lib/git directory
+      instead of /var/cache/git.
+    * git.README.Debian, git-daemon-run.README.Debian,
+      git-daemon-sysvinit.README.Debian, gitweb.README.Debian:
+      update for the new project root.
+    * git.NEWS.Debian: advertise the change and explain how to
+      adapt to it.
+
+ -- Jonathan Nieder <jrnie...@gmail.com>  Mon, 20 May 2013 00:42:35 -0700
+
 git (1:1.8.3~rc3-1) experimental; urgency=low
 
   * new upstream release candidate.
diff --git i/debian/git-daemon-run.README.Debian 
w/debian/git-daemon-run.README.Debian
index 943096aa..ffde9a6a 100644
--- i/debian/git-daemon-run.README.Debian
+++ w/debian/git-daemon-run.README.Debian
@@ -17,13 +17,13 @@ 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/cache/git/ for
+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/cache/git/foo.git
+ 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.
diff --git i/debian/git-daemon-sysvinit.README.Debian 
w/debian/git-daemon-sysvinit.README.Debian
index 320d7001..cea76b64 100644
--- i/debian/git-daemon-sysvinit.README.Debian
+++ w/debian/git-daemon-sysvinit.README.Debian
@@ -17,13 +17,13 @@ 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/cache/git/ for
+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/cache/git/foo.git
+ 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.
diff --git i/debian/git-daemon.default w/debian/git-daemon.default
index 20208055..fd62168c 100644
--- i/debian/git-daemon.default
+++ w/debian/git-daemon.default
@@ -8,7 +8,7 @@
 
 GIT_DAEMON_ENABLE=false
 GIT_DAEMON_USER=gitdaemon
-GIT_DAEMON_DIRECTORY=/var/cache/git
+GIT_DAEMON_DIRECTORY=/var/lib/git
 
 # Additional options that are passed to the Daemon.
 GIT_DAEMON_OPTIONS=""
diff --git i/debian/git-daemon.init w/debian/git-daemon.init
index 7bfe17d9..cc98a00b 100644
--- i/debian/git-daemon.init
+++ w/debian/git-daemon.init
@@ -26,8 +26,8 @@ SCRIPTNAME=/etc/init.d/$NAME
 [ -r /etc/default/$NAME ] && . /etc/default/$NAME
 
 GIT_DAEMON_USER=${GIT_DAEMON_USER:-gitdaemon}
-GIT_DAEMON_BASE_PATH=${GIT_DAEMON_BASE_PATH:-/var/cache}
-GIT_DAEMON_DIRECTORY=${GIT_DAEMON_DIRECTORY:-/var/cache/git}
+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"
diff --git i/debian/git-daemon/run w/debian/git-daemon/run
index ef24724b..b8655266 100755
--- i/debian/git-daemon/run
+++ w/debian/git-daemon/run
@@ -3,4 +3,4 @@ exec 2>&1
 echo 'git-daemon starting.'
 exec chpst -ugitdaemon \
   "$(git --exec-path)"/git-daemon --verbose --reuseaddr \
-    --base-path=/var/cache /var/cache/git
+    --base-path=/var/lib /var/lib/git
diff --git i/debian/git.NEWS.Debian w/debian/git.NEWS.Debian
index 8502b032..ab6ab78b 100644
--- i/debian/git.NEWS.Debian
+++ w/debian/git.NEWS.Debian
@@ -1,3 +1,25 @@
+git (1:1.8.2~rc3-1.1) experimental; urgency=low
+
+  The Debian-provided configurations of gitweb and git-daemon have
+  been changed to look for repositories under /var/lib/git instead
+  of /var/cache/git.
+
+  To ensure your existing repositories remain accessible:
+
+    rmdir /var/lib/git
+    mv /var/cache/git /var/lib/git
+
+  Or:
+
+    cd /var/lib/git
+    mv ../../cache/git/* .
+
+  You may also want to adjust your inetd, rsyncd, and web server
+  configuration to use the new base path.
+  See /usr/share/doc/git/README.Debian for details.
+
+ -- Jonathan Nieder <jrnie...@gmail.com>  Sun, 19 May 2013 21:16:46 -0700
+
 git (1:1.8.2~rc0-1) experimental; urgency=low
 
   The default behavior of "git push" when run without specifying any
diff --git i/debian/git.README.Debian w/debian/git.README.Debian
index b96faf97..7a25a5c7 100644
--- i/debian/git.README.Debian
+++ w/debian/git.README.Debian
@@ -9,8 +9,8 @@ repositories.  This package provides the git-daemon program, to 
enable a
 git-daemon service, configure inetd(8) to launch it on demand, or install the
 git-daemon-run package to run it permanently:
  cat >> /etc/inetd.conf <<EOF
-git stream tcp4 nowait nobody /usr/bin/git git daemon --inetd 
--base-path=/var/cache /var/cache/git
-git stream tcp6 nowait nobody /usr/bin/git git daemon --inetd 
--base-path=/var/cache /var/cache/git
+git stream tcp4 nowait nobody /usr/bin/git git daemon --inetd 
--base-path=/var/lib /var/lib/git
+git stream tcp6 nowait nobody /usr/bin/git git daemon --inetd 
--base-path=/var/lib /var/lib/git
 EOF
 
 Or:
@@ -22,12 +22,12 @@ logs:
  sv stat git-daemon
  cat /var/log/git-daemon/current
 
-The git daemon by default looks into the directory /var/cache/git/ for
+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 /var/cache/git/, symlinks pointing
+the repositories' .git subdirectories in /var/lib/git/, symlinks pointing
 to the corresponding subdirectories in the repositories are just fine, e.g.:
 
- ln -s ~pape/git/foo/.git /var/cache/git/foo.git
+ ln -s ~pape/git/foo/.git /var/lib/git/foo.git
 
 Now git-clone git://git.example.org/git/repo will work.
 
@@ -36,7 +36,7 @@ repositories.  You then need to add a stanza to 
/etc/rsyncd.conf that looks
 like this:
 
 [git]
-    path = /var/cache/git
+    path = /var/lib/git
     readonly = yes
 
 Now git-clone rsync://git.example.org/git/repo will work.
@@ -52,12 +52,12 @@ configuration that looks like this:
     ServerAdmin webmas...@example.org
     HeaderName HEADER
     # bogus but safe DocumentRoot
-    DocumentRoot /var/cache/git
+    DocumentRoot /var/lib/git
     ErrorLog /var/log/apache2/git.example.org-error.log
     CustomLog /var/log/apache2/git.example.org-access.log combined
     Alias /robots.txt /var/www/cvs.robots.txt
     Alias /static /usr/share/gitweb/static
-    Alias /git /var/cache/git
+    Alias /git /var/lib/git
     ScriptAlias / /usr/share/gitweb/gitweb.cgi
     RedirectMatch permanent "^/~(.*)$" "http://example.org/~$1"; 
 </VirtualHost>
diff --git i/debian/gitweb.README.Debian w/debian/gitweb.README.Debian
index f2ea2315..331935d5 100644
--- i/debian/gitweb.README.Debian
+++ w/debian/gitweb.README.Debian
@@ -1,12 +1,12 @@
 gitweb for Debian
 -----------------
 
-The gitweb CGI by default looks into the directory /var/cache/git/ for
+The gitweb CGI by default looks into the directory /var/lib/git/ for
 browsable repositories (this is configured in /etc/gitweb.conf).  It expects
-the repositories' .git subdirectories in /var/cache/git/, symlinks pointing
+the repositories' .git subdirectories in /var/lib/git/, symlinks pointing
 to the corresponding subdirectories in the repositories are just fine, e.g.:
 
- ln -s ~pape/git/foo/.git /var/cache/git/foo.git
+ ln -s ~pape/git/foo/.git /var/lib/git/foo.git
 
 On systems with an Apache webserver, gitweb is automatically made available at
 http://localhost/gitweb. You can deactivate it by commenting out the first
diff --git i/debian/gitweb.conf w/debian/gitweb.conf
index ea99551c..1c398c65 100644
--- i/debian/gitweb.conf
+++ w/debian/gitweb.conf
@@ -1,5 +1,5 @@
 # path to git projects (<project>.git)
-$projectroot = "/var/cache/git";
+$projectroot = "/var/lib/git";
 
 # directory to use for temp files
 $git_temp = "/tmp";
diff --git i/debian/rules w/debian/rules
index 3693ec69..37381e8b 100755
--- i/debian/rules
+++ w/debian/rules
@@ -114,7 +114,7 @@ install-arch: deb-checkdir deb-checkuid build-arch-stamp
        rm -rf '$(GIT)'
        install -d -m0755 '$(GIT)'/usr/bin
        DESTDIR='$(GIT)' $(MAKE) install $(OPTS)
-       install -d -m0755 '$(GIT)'/var/cache/git
+       install -d -m0755 '$(GIT)'/var/lib/git
        rm -f '$(GIT)'/usr/share/perl5/Error.pm
        rm -rf '$(GIT)'/usr/share/man
        chmod 644 '$(GIT)'/usr/share/perl5/Git.pm


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to