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

case "$1" in
     configure)
	echo "Installing TestDisk and PhotoRec for Nokia N900..."
	cd /usr/bin

	echo "Creating TestDisk and PhotoRec symlinks..."
	if [ -h /usr/bin/photorec ];
	then
	   echo "Skipping PhotoRec symlink creation, it's already present.."
	else
	    ln -s /opt/recovery-tools/photorec photorec
	fi

	if [ -h /usr/bin/testdisk ];
	then
	    echo "Skipping TestDisk symlink creation, it's already present.."
	else
	    ln -s /opt/recovery-tools/testdisk testdisk
	fi

	if [ -f /opt/recovery-tools/photorec ];
	then
	    echo ""
	else
	    echo "Restoring PhotoRec..."
	    cp /opt/recovery-tools/photorec_6.11-4 /opt/recovery-tools/photorec
	fi

	if [ -f /opt/recovery-tools/testdisk ];
	then
	    echo ""
	else
	    echo "Restoring TestDisk..."
	    cp /opt/recovery-tools/testdisk_6.11-4 /opt/recovery-tools/testdisk
	fi
	
	rm -f /opt/recovery-tools/*_6.11-4
	
	echo "TestDisk and PhotoRec for Nokia N900 installed successfully."
	exit 0
	;;

     abort-upgrade|abort-remove|abort-deconfigure)
    	;;

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

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


