#!/bin/bash
# $Id: startadsl,v 1.6 2004/07/25 20:18:17 Tux Exp $
# Name: startadsl
# Goal: start ADSL connexion
# Author: Tux
# Params:
#	h = display help
#	m = start mire
#	s = simple mode (don't use ifup & ifdown scripts => do not requiere ifcfg-ethX)
#	t = set timeout delay (default=60s)
#	a = use ip adress (use -a xx.xx.xx.xx), imply simple mode
#	d = launch pppd in debug mode
# Error codes:
#	1 = pppd already lauched (non degroup)
#	2 = modem can't be synchronized
#	3 = can't launch pppd
#	4 = can't set modem interface "up"
#	5 = lock still present
#	6 = modem not operational

exit 123

# startadsl is lauched manually. If the modem is not operational,
# the script is immediately stopped
if ! $EAGLESTAT | grep -q "$OPER_STR" ; then
	echo -e "$NOT_OPER_MSG"
	exit 6
fi

fctStartAdsl "$@"
RES=$?

case $RES in
	0)	# no error occurs, write lock file (used by testconnec)
		touch $SYSCONF_FILE ;;
	1)	echo -e $ALREADY_MSG ;;
	2)	echo -e $CANT_SYNC_MSG ;;
	3)	echo -e $PPPD_ERR_MSG ;;
	4)	echo -e $IFUP_ERR_MSG ;;
	5)	echo -e $LOCK_MSG ;;
esac
exit $RES

#***************************************************************************
# $Log: startadsl,v $
# Revision 1.6  2004/07/25 20:18:17  Tux
# - return error code
# - cosmetic changes
#
# Revision 1.5  2004/07/19 20:44:22  Tux
# - startadsl now put lock file (used later by testconnec)
#
# Revision 1.4  2004/07/16 21:09:47  Tux
# - simplify parameters processing
#
# Revision 1.3  2004/04/21 20:02:27  Tux
# *** empty log message ***
#
#***************************************************************************/
