#!/bin/sh
#--------------------------------------------------------------------
# /sbin/shutdown -- replacement for 'shutdown' wrapping busybox tools
#
# Creation:     2020-01-10 Alexander Dahl <alex@eisfair.org>
# Last Update:  $Id: shutdown 58555 2020-05-10 18:14:22Z alex $
#--------------------------------------------------------------------

usage ()
{
  echo "$0 [OPTION]"
  echo ""
  echo "Shut down the system."
  echo ""
  echo "     --help      Show this help"
  echo "  -H --halt      Halt the machine"
  echo "  -P --poweroff  Power-off the machine"
  echo "  -r --reboot    Reboot the machine"
}

if [ -z "$1" ]
then
    usage
    exit
fi

while [ "$1" ]
  do
    case "$1" in
      --help)
          usage
          exit
          ;;
      -H|--halt)
          /sbin/halt
          ;;
      -P|--poweroff) 
          /sbin/poweroff
          ;;
      -r|--reboot) 
          /sbin/reboot
          ;;
    esac
  shift
done
