#!/bin/sh
### BEGIN INIT INFO
# Provides:            halt
# Required-Start:
# Required-Stop:
# Should-Start:
# Should-Stop:
# Default-Start:
# Default-Stop:        0
# Short-Description:   Halt the system
# X-Required:          true
### END INIT INFO

. /lib/lsb/init-functions
[ -r /etc/default/halt ] && . /etc/default/halt

case "$1" in
  stop)
    poweroff='-p'
    netdown='-i'

    if [ "$HALT" = "halt" ]; then
      poweroff=''
    fi

    if [ "$NETDOWN" = "no" ]; then
      netdown=''
    fi

    log_init_msg "Halting system"
    halt -d -f $netdown $poweroff
    ;;
  *)
    echo "Usage: [stop]"
    exit 1
    ;;
esac

exit 0
