#!/bin/sh

if [ "$1" = "configure" ]; then

	if [ -d /usr/doc -a ! -e /usr/doc/dgcmodem -a -d /usr/share/doc/dgcmodem ]; then
		ln -sf ../share/doc/dgcmodem /usr/doc/dgcmodem
	fi

	echo "DEB" > "/etc/dgcmodem/package"

	if [ -z "${CNXT_NOAUTOCONFIG}" ]; then
        	/usr/sbin/dgcconfig --auto
		ret=$?
		if [ "${ret}" -eq 123 ]; then
			ret=0
		fi
		if [ "${ret}" -eq 124 -a -z "${CNXT_NOWRONGKERNELFAIL}" ]; then
			ret=0
		fi
		exit ${ret}
	else
        	echo "To complete the installation and configuration of your modem,"
        	echo "please run \"dgcconfig\" (or \"/usr/sbin/dgcconfig\")"
        	exit 0
	fi
fi

