#!/bin/sh
# chkconfig: 345 98 98
# description: Pre-configure ethernet adapters.
#
# processname chnprep

# ncu Start charon network preparation
### BEGIN INIT INFO
# Provides: ncu
# Required-Start:
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: start and stop chnprep
# Description: Start, stop chnprep
### END INIT INFO

NCU_CFG=/etc/ncu.cfg

# Source function library.
. /etc/init.d/functions
# only usable for root
[ $EUID = 0 ] || exit 4
if [ ! -x /sbin/chnprep.sh ]; then
    echo -n "/sbin/chnprep does not exist."; warning; echo
    exit 5
fi

start() {
    /sbin/chnprep.sh run && success || failure
}
case "$1" in
    start)
	[ ! -f "$NCU_CFG" ] && echo "$0:warning: absent $NCU_CFG file" && warning && exit 0
	start
	RETVAL=$?
	;;
    stop)
	RETVAL=0
	;;
    restart|force-reload)
	RETVAL=0
	;;
    reload)
	RETVAL=0
	;;      
    condrestart|try-restart)
	RETVAL=0
	;;
    status)
	status
	RETVAL=0
	;;
    *)
	echo $"Usage: ncu {start|stop|status}"
	RETVAL=2
	;;
esac

exit $RETVAL