#!/bin/bash
# postinst script for atokx2

# use debconf
. /usr/share/debconf/confmodule

if [ "$1" = "configure" -a ! -d /usr/lib/atokx2/opt ]; then

    # get debconf variable
    db_get atokx2/archive_dir
    DIR=$RET

    if ! /usr/sbin/install-atokx2 install $DIR; then
        echo 'Installation was failed.'
	echo 'Please check archive files and run "install-atokx2" command manually.'
	exit 1
    fi

    if [ -z "`/bin/pidof atokx2mngdaemon`" ]; then
    	/etc/init.d/atokx2 start
    fi

fi

#DEBHELPER#
