tags 708051 + pending
quit

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

>>>>  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
[...]
> OK.  The patch for steps 2 and 3 looks good; just step 1 to go.

Sorry for the delay.  Here's a patch to finish the job.  Thoughts
welcome, as always.

-- >8 --
Subject: git.preinst: install symlinks for projectroot transition

This way, during and after the upgrade both the old /var/cache/git/*
and the new /var/lib/git/* paths will be valid, avoiding a denial
of service during the projectroot change.

The sysadmin can leave the configuration as is or can double-check
that all configuration uses the new path and replace the symlinks from
/var/lib/git/ to .../cache/git/ with something more permanent.
Include advice to this end in NEWS.Debian.

If some link already exists during the upgrade (for example because
the preinst partially ran and was interrupted or because the sysadmin
prepared already with links going the other way), leave it alone and
continue with the rest.

Signed-off-by: Jonathan Nieder <jrnie...@gmail.com>
---
 debian/changelog       |  2 ++
 debian/git.NEWS.Debian | 20 +++++++++-----------
 debian/git.preinst     | 15 +++++++++++++++
 3 files changed, 26 insertions(+), 11 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 5a7c8bc..3f7b251 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -11,6 +11,8 @@ git (1:1.8.3.2-1.1) experimental; urgency=low
     * git.README.Debian, git-daemon-run.README.Debian,
       git-daemon-sysvinit.README.Debian, gitweb.README.Debian:
       update for the new project root.
+    * git.preinst: install symlinks /var/lib/git/* ->
+      ../../cache/git/*.
     * git.NEWS.Debian: advertise the change and explain how to
       adapt to it.
 
diff --git a/debian/git.NEWS.Debian b/debian/git.NEWS.Debian
index 32c8acf..9312a25 100644
--- a/debian/git.NEWS.Debian
+++ b/debian/git.NEWS.Debian
@@ -4,22 +4,20 @@ git (1:1.8.3.2-1.1) experimental; urgency=low
   configured to look for repositories under /var/lib/git by default
   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>  Sat, 06 Jul 2013 15:22:18 -0700
+  Symlinks are installed during the upgrade to ensure existing
+  repositories remain accessible.  If no local scripts or
+  configuration depend on /var/cache/git then it is safe to remove
+  that directory after replacing these symlinks with their targets:
+
+    mv -f /var/cache/git/* /var/lib/git/
+    rmdir /var/cache/git
+
+ -- Jonathan Nieder <jrnie...@gmail.com>  Sat, 06 Jul 2013 16:17:48 -0700
 
 git (1:1.8.2~rc0-1) experimental; urgency=low
 
diff --git a/debian/git.preinst b/debian/git.preinst
index da32188..73bfecf 100644
--- a/debian/git.preinst
+++ b/debian/git.preinst
@@ -1,6 +1,21 @@
 #!/bin/sh
 set -e
 
+# /var/cache/git/ -> /var/lib/git/ transition
+if test "$1" = upgrade &&
+   dpkg --compare-versions "$2" lt-nl '1:1.8.3.2-1.1'; then
+       mkdir -m 755 -p /var/lib/git
+       (
+               cd /var/lib/git
+               for target in ../../cache/git/*; do
+                       link=${target#../../cache/git/}
+                       if ! test -L "$link" && ! test -e "$link"; then
+                               ln -s "$target" "$link"
+                       fi
+               done
+       )
+fi
+
 # Snippet based on dpkg-maintscript-helper from dpkg 1.15.8.
 # Postinst explains why.
 rm_conffile () {
-- 
1.8.3.1


-- 
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