]> git.deb.at Git - pkg/blosxom.git/blob - debian/preinst
add closes
[pkg/blosxom.git] / debian / preinst
1 #!/bin/sh
2 # preinst script for blosxom
3 # copyright 2007-2008 by Rhonda D'Vine <rhonda@debian.org>
4 # Licenced in the same way as blosxom itself
5
6 set -e
7
8 rm_conffile() {
9         PKGNAME="$1"
10         CONFFILE="$2"
11         if [ -e "$CONFFILE" ]; then
12                 md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`"
13                 old_md5sum="`dpkg-query -W -f='${Conffiles}' $PKGNAME | sed -n -e \"\\\\' $CONFFILE '{s/ obsolete$//;s/.* //p}\"`"
14                 if [ "$md5sum" != "$old_md5sum" ]; then
15                         echo "Obsolete conffile $CONFFILE has been modified by you."
16                         echo "Saving as $CONFFILE.dpkg-bak ..."
17                         mv -f "$CONFFILE" "$CONFFILE".dpkg-bak
18                 else
19                         echo "Removing obsolete conffile $CONFFILE ..."
20                         rm -f "$CONFFILE"
21                 fi
22         fi
23 }
24
25
26 # cleanup for old flavors that got installed by packages prior to 2.1.0
27 case "$1" in
28 install|upgrade)
29         if dpkg --compare-versions "$2" le-nl "2.1.0-1"; then
30                 for i in content_type.1993 content_type.html content_type.index \
31                         date.1993  date.html  date.index \
32                         foot.1993  foot.html  foot.index \
33                         head.1993  head.html  head.index \
34                         story.1993 story.html story.index ; do
35                         rm_conffile blosxom "/etc/blosxom/flavours/$i"
36                 done
37                 rm_conffile blosxom "/etc/blosxom/plugins/timezone"
38         fi
39         if [ -d /var/lib/blosxom/data/flavours ] ; then
40                 cd /var/lib/blosxom/data/flavours
41                 for i in content_type.1993 content_type.html content_type.index \
42                         date.1993  date.html  date.index \
43                         foot.1993  foot.html  foot.index \
44                         head.1993  head.html  head.index \
45                         story.1993 story.html story.index ; do
46                         test ! -L $i || test -f $i || rm $i
47                 done
48         fi
49 esac
50
51 exit 0