#!/bin/sh
# Filename:      preinst
# Purpose:       preinst script for package grml-firefox
# Authors:       grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
# Bug-Reports:   see http://grml.org/bugs/
# License:       This file is licensed under the GPL v2.
# Latest change: Mit Feb 27 18:22:17 CET 2008 [mika]
################################################################################

set -e

case "$1" in
   install|upgrade)
     # get rid of this diversion, let's use /etc/skel/.mozilla* for bookmarks only;
     # grml-firefox stopped shipping the file starting with 0.3.3, so remove
     # the diversion when upgrading from versions older than 0.3.3
     if [ -n "$2" ]; then
       if dpkg --compare-versions $2 lt 0.3.3 ; then
         if dpkg-divert --list /etc/mozilla-firefox/profile/bookmarks.html | grep -q grml-firefox ; then
                dpkg-divert --remove --rename --package grml-firefox --divert \
                            /etc/mozilla-firefox/profile/bookmarks.html.original \
                            /etc/mozilla-firefox/profile/bookmarks.html
         fi
       fi
     fi
     ;;
   *)
     echo "preinst called with unknown argument \`$1'" >&2
     exit 1
esac

exit 0

## END OF FILE #################################################################
