Première tentative de support de fichiers de configuration Debian.
[auf-git-etc.git] / debian / preinst
1 #!/bin/sh
2 # preinst script for test
3 #
4 # see: dh_installdeb(1)
5
6 set -e
7
8 # XXX: debogage, à supprimer avant release
9 echo "==> preinst($@) `date`" >> /tmp/auf-git-etc.debug
10 ls -la /etc/auf-git-etc >> /tmp/auf-git-etc.debug
11
12 # summary of how this script can be called:
13 #        * <new-preinst> `install'
14 #        * <new-preinst> `install' <old-version>
15 #        * <new-preinst> `upgrade' <old-version>
16 #        * <old-preinst> `abort-upgrade' <new-version>
17 # for details, see http://www.debian.org/doc/debian-policy/ or
18 # the debian-policy package
19
20
21 case "$1" in
22     install|upgrade)
23         if [ "`readlink -f /.git`" = "/var/lib/git/root" ]; then
24             # on gère la migration des exclude et post-commit en conffile
25             if [ ! -L /.git/info/exclude ]; then
26                 mv -f /etc/auf-git-etc/exclude /etc/auf-git-etc/exclude.dpkg-dist
27                 mv /.git/info/exclude /etc/auf-git-etc/
28             fi
29             if [ ! -L /.git/hooks/post-commit ]; then
30                 mv -f /etc/auf-git-etc/post-commit /etc/auf-git-etc/post-commit.dpkg-dist
31                 mv /.git/hooks/post-commit /etc/auf-git-etc/
32             fi
33         fi
34     ;;
35
36     abort-upgrade)
37     ;;
38
39     *)
40         echo "preinst called with unknown argument \`$1'" >&2
41         exit 1
42     ;;
43 esac
44
45 # dh_installdeb will replace this with shell code automatically
46 # generated by other debhelper scripts.
47
48 #DEBHELPER#
49
50 exit 0