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
12 for target
in ..
/..
/cache
/git
/*; do
13 if ! test -L "$target" && ! test -e "$target"; then
17 link
=${target#../../cache/git/}
18 if ! test -L "$link" && ! test -e "$link"; then
19 ln -s "$target" "$link"
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/*'
36 # Git versions before 1.7.7-2 kept about 100 hard links to
37 # /usr/lib/git-core/git at /usr/lib/git-core/git-* to avoid
38 # wasting time resolving a symlink when old scripts call "git
39 # foo" as git-foo. Btrfs doesn't like to have more than 130 or
40 # so links to a single inode in a given directory. dpkg versions
41 # 1.16.1 and later temporarily double the number of hard links to
42 # an inode when upgrading a package.
44 # Replace the hard links with symlinks _before_ upgrading to
47 # For added fun, coreutils mv will not replace a file by a
48 # symlink to the same inode (bug #654666). We give
49 # /usr/lib/git-core/git its own inode to work around that.
51 if test "$1" = upgrade
&&
52 dpkg
--compare-versions "$2" lt-nl
'1:1.7.7-2'; then
53 refinode
=$
(stat
-c%i
/usr
/lib
/git-core
/git-add
)
55 rm -f /usr
/lib
/git-core
/git.tmp
56 cp -p /usr
/lib
/git-core
/git
/usr
/lib
/git-core
/git.tmp
57 mv -f /usr
/lib
/git-core
/git.tmp
/usr
/lib
/git-core
/git
58 for f
in /usr
/lib
/git-core
/*; do
59 test "$f" != /usr
/lib
/git-core
/git
&&
60 test "$f" != /usr
/lib
/git-core
/git-add ||
continue
62 inode
=$
(stat
-c%i
"$f")
63 test "$inode" = "$refinode" ||
continue