#!/bin/sh
# preinst script for recovery-tools
#
# by Luigi Cotignano
# http://n900.altervista.org

# summary of how this script can be called:
#        * <new-preinst> `install'
#        * <new-preinst> `install' <old-version>
#        * <new-preinst> `upgrade' <old-version>
#        * <old-preinst> `abort-upgrade' <new-version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package

case "$1" in
    install|upgrade)
    # Backup executable if update is performed by an old script version
    if [ -f /opt/recovery-tools/testdisk ];
    then
    	cp /opt/recovery-tools/testdisk /opt/recovery-tools/testdisk_6.11-4
    fi

    if [ -f /opt/recovery-tools/photorec ];
    then
    	cp /opt/recovery-tools/photorec /opt/recovery-tools/photorec_6.11-4
    fi
    ;;

    abort-upgrade)
    ;;

    *)
        echo "Error: unable to remove TestDisk and PhotoRec, preinst called with unknown argument \`$1'" >&2
        exit 1
    ;;
esac

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#

exit 0
