#!/bin/sh
#
#    Copyright (c) 1996-2000 Brocade Communications Systems, Inc.
#    All rights reserved.
#
#    Original authors:
#      Miquel van Smoorenburg <miquels@drinkel.nl.mugnet.org>
#      Damien Niel, Red Hat Systems
#
#    Initialization script to halt/reboot the system.
#

# Source common library
. /etc/init.d/functions

case "$0" in
*halt)
    message="The system is halted"
    command="halt"
    ;;

*reboot)
    message="Please stand by while rebooting the system..."
    command="reboot"
    ;;

*)
    echo "$0: call me as \"rc.halt\" or \"rc.reboot\" please!"
    exit 1
    ;;
esac
#Executing platform yield which will shutdown ASIC  DMA
/fabos/cliexec/platformyield 

sleep 3
echo "platformyield completed!"
${KILLALL} -TERM wdtd
echo "wdtd killed"
/sbin/killall5
echo "Unmounting all filesystems."
sleep 1
umount -a -f 
mount -n -o remount,ro /

# Now halt or reboot.
echo "$message"
eval $command -i -d -p
