#!/bin/bash
#
# chkconfig: 345 51 49
# description: Eos system init script (runs after POST, before ProcMgr)

# XXX_LWR: figure out the exact numbers at which this script runs
#          (currently 51 and 49). Our only requirement at this point
#          is to run before ProcMgr

# This script is written as a bash script, calling /usr/bin/EosInitStage
# to do all of the real work, so that we can use the existing code to
# print 'OK'/'FAIL' at bootup time.

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

start() {
    echo -n $"Starting EOS initialization stage 2: "
    # Redirect stdin to prevent EosInitStage from dropping into the debugger on failure
    if /usr/bin/EosInitStage --stage 2 </dev/null >>/var/log/EosInitStage 2>&1; then
        success
        echo
    else
        # If EosInitStage fails, the system is pretty much hosed
        failure
        echo
        echo $"   (errors in /var/log/EosInitStage; log in as 'root' to troubleshoot)"
        exit 1
    fi
}

# Once we figure out what it means to "stop" Eos, add support to do
# that here.
case "$1" in
start)
    start
    ;;
stop)
   ;;
*)
    echo $"Usage: $0 {start}"
    exit 1
esac
