#!/bin/bash

# metaconf      Script to run metaconf at boot time
#
# chkconfig: 345 13 88 
# description: foobar
# probe: true

# Andr Ruiz <andre@ruiz.net>

. /etc/rc.d/init.d/functions

type -path -a 'metaconf-chooser.sh' >/dev/null || exit 1

case "$1" in

    start)
	metaconf-autochooser.sh || metaconf-chooser.sh -c -t 20
	touch /var/lock/subsys/metaconf
        ;;

    stop)
        gprintf "Running metaconf offline: "
        metaconf offline
	echo_success; gprintf "\n"
	rm -f /var/lock/subsys/metaconf
        ;;

    restart|reload)
	$0 stop
	$0 start
        ;;

    status)
        ;;

    *)
        gprintf "Usage: %s {start|stop|restart|reload|status}\n" "metaconf"
	;;

esac

