#!/bin/bash
#
# livecd This scripts setup livecd
#
# chkconfig: 2345 30 30
# description:	Starts and stops each livecd setup subsystem.
#

# Do not load RH compatibility interface.
WITHOUT_RC_COMPAT=1

# source function library
. /etc/init.d/functions

SourceIfNotEmpty /etc/sysconfig/livecd

[ "$LIVECD" == "yes" ] || exit 0

LOCKFILE=/var/lock/subsys/livecd

RETVAL=0

LIVECD_DIR=/etc/livecd/startup

run_rcs () {
    pushd $LIVECD_DIR >/dev/null 2>&1
    for RC in *.livecd
    do
	./$RC $1
	RETVAL=$?
    done
    popd >/dev/null 2>&1
}

case "$1" in
    start|restart)
	run_rcs $1
	[ $RETVAL -eq 0 ] && touch $LOCKFILE
	;;
    stop)
        ;;
    force-reload)
	run_rcs $1
        ;;
    status)
	run_rcs $1
	;;
    condrestart|condstop)
	RETVAL=0
	;;
    *)
	echo $"Usage: $0 {start|stop|restart|status|force_reload|condrestart|condstop}"
	RETVAL=3
	;;
esac

exit $RETVAL
