#!/bin/sh
# preinst script for recovery-tools-6.11
#
# 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>
case "$1" in
    install)
    echo "Installing TestDisk and PhotoRec for Nokia N900..."
    cd /usr/bin
    echo "Creating TestDisk and PhotoRec symlinks..."
    ln -s /opt/recovery-tools/photorec photorec
    ln -s /opt/recovery-tools/testdisk testdisk
    ;;

    upgrade)
    # Check if the application was previoulsy already installed
    if [ -f /opt/recovery-tools/photorec ]
    then
      echo "Removing previous PhotoRec version for Nokia N900..."
      rm -f /opt/recovery-tools/photorec
    fi

    if [ -f /opt/recovery-tools/testdisk ]
    then
      echo "Removing previous TestDisk version for Nokia N900..."
      rm -f /opt/recovery-tools/testdisk
    fi

    ;;

    abort-upgrade)
    ;;

    *)
        echo "Error: upgrade aborted!" >&2
        exit 1
    ;;
esac

#DEBHELPER#

exit 0


