debian: new upstream release
[git/debian.git] / debian / git.preinst
blob05be8e019410a1de67b7d4b03bffd1656c68f892
1 #!/bin/sh
2 set -e
4 #DEBHELPER#
6 # /var/cache/git/ -> /var/lib/git/ transition
7 if test "$1" = upgrade &&
8 dpkg --compare-versions "$2" lt-nl '1:1.8.4~rc0-1'; then
9 mkdir -m 755 -p /var/lib/git
11 cd /var/lib/git
12 for target in ../../cache/git/*; do
13 if ! test -L "$target" && ! test -e "$target"; then
14 continue
17 link=${target#../../cache/git/}
18 if ! test -L "$link" && ! test -e "$link"; then
19 ln -s "$target" "$link"
21 done
25 # A previous version of the /var/lib/git/ transition code
26 # left behind a symlink '/var/lib/git/*' -> '../../cache/git/*'.
27 if test "$1" = upgrade &&
28 dpkg --compare-versions "$2" eq '1:1.8.4~rc0-1' &&
29 test -L '/var/lib/git/*'; then
30 target=$(readlink '/var/lib/git/*')
31 if test "$target" = '../../cache/git/*'; then
32 rm -f '/var/lib/git/*'