#!/bin/sh
# Allow sysvinit commands to still be ran in case nitro is not PID1
if [ ! "$(cat /proc/1/comm)" = "nitro" ]; then
	/sbin/$(basename $0)
else

# Nitro commands

	prg=$(basename $0)

	case $prg in
		poweroff|halt|shutdown) action="Shutdown"   ;;
						reboot) action="Reboot"    	;;
							 *) exit 1              ;;
	esac

	/sbin/nitroctl $action
fi
