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