#!/bin/sh
#
# Startup script for freenet6.
#
# chkconfig: 345 85 15
# description: freenet6 is a to service that facilitates a faster deployment of an IPv6 Internet
#
# processname:	tspc
# config: /etc/tspc.conf

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

if [ ${NETWORKING} = "no" ]
then
	exit 0
fi

[ -x /usr/sbin/tspc ] || exit 0

# See how we were called.
case "$1" in
  start)
	gprintf "Starting freenet6: "
	daemon tspc -vf /etc/tspc.conf
	RETVAL=$?
	echo
	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/freenet6
	;;
  stop)
	gprintf "Stopping freenet6: "
	# in theory, this can be anything, but, in practice, only
	# freenet6 work.
 	( ( ifconfig | grep -q freenet6 ) && ifconfig freenet6 down ) && success || failure
	RETVAL=$?
	echo
	[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/freenet6
	;;
  status)
	status freenet6
	RETVAL=$?
	;;
  restart | reload)
	$0 stop
	$0 start
	RETVAL=$?
	;;
  *)
	gprintf "Usage: freenet6 {start|stop|status|restart|reload}\n"
	exit 1
esac

exit $RETVAL
