#!/bin/sh
#
# Reboot script for the Hardware Management Console
#
# Description: Script used to process manual reboot requests.
#
# Change log:
#
# 02/08/2007 Kurt Schroeder  -01 Handle reboot specific options.

realname="manualReboot";
runname="`basename $0`";

if [ "$runname" == "$realname" ]; then
   consolePath="$1";
   reason="$2";
else
   reason="0x0000000";
fi
if [ -z "${consolePath}" ]; then
   consolePath="/console";
fi
. "${consolePath}/hmcfunctions";
setupEnv ${consolePath} > /dev/null;

logerror '0x0A' '015' '0x01' '0x0045' "$reason" '0xE040' 'CTRLALTDEL' '1'

if [ `whoami` == "root" ]; then
   hmcinitlog "The console was rebooted (reason=${reason}).";
fi

if [ "$runname" == "$realname" ] && [ "$3" == "reboot" ]; then
   /sbin/reboot;
elif [ "$runname" == "reboot" ]; then
   /sbin/reboot "$@"
fi