debian/diff: adapt to API breakage in perl modules
[git/debian.git] / debian / git.postinst
blob1657c0e81128e75dbd084acf90b0ab136902eb87
1 #!/bin/sh
2 set -e
3 test "$1" = configure || exit 0
5 # Snippet based on dpkg-maintscript-helper from dpkg 1.15.8. Using a
6 # home-grown snippet instead of using Pre-Depends: dpkg (>= 1.15.7)
7 # makes the package easier to try out on old systems without requiring
8 # new dpkg in these early times.
10 # Kind reader of the future: it's about time to rip this out and use a
11 # call to dpkg-maintscript-helper, don't you think?
12 rm_conffile () {
13 CONFFILE=$1; shift
14 if dpkg --compare-versions "$2" lt-nl "$3"; then
15 if test -e "$CONFFILE.dpkg-backup"; then
16 mv -f "$CONFFILE.dpkg-backup" "$CONFFILE.dpkg-bak"
18 if test -e "$CONFFILE.dpkg-remove"; then
19 echo "Removing $CONFFILE ..."
20 rm -f "$CONFFILE.dpkg-remove"
25 rm_conffile /etc/bash_completion.d/git "$1" "$2" '1:1.8.0-1~'
27 removed_conffile=/etc/emacs/site-start.d/50git-core.el
28 rm_conffile "$removed_conffile" "$1" "$2" '1:1.7.4.1-2~'
30 # Carry over modifications so git-el can use them.
31 if dpkg --compare-versions "$2" lt '1:1.7.4.1-2~' &&
32 ! test -e "$removed_conffile" &&
33 test -r "$removed_conffile".dpkg-bak; then
34 mv "$removed_conffile".dpkg-bak "$removed_conffile"
37 # 1.7.7-1 replaces /usr/share/doc/git/contrib/hooks with a symlink,
38 # but dpkg doesn't do so on package upgrade
39 if test -n "$2" && dpkg --compare-versions "$2" lt '1:1.7.7-1' &&
40 test ! -L /usr/share/doc/git/contrib/hooks &&
41 test -d /usr/share/doc/git/contrib/hooks; then
42 rmdir /usr/share/doc/git/contrib/hooks &&
43 ln -s ../../../git-core/contrib/hooks \
44 /usr/share/doc/git/contrib/hooks