#!/bin/busybox ash

export TEXTDOMAIN=fatdog

# debounce
[ -e /tmp/acpi_poweroff ] && exit
touch /tmp/acpi_poweroff

# check for 'noprompt' parameter
for p; do
	case $p in
		noprompt|-f) unset DISPLAY
	esac
done

# display prompt if there is X running, otherwise go straight to shutdown
echo > /tmp/is_reboot
if [ "$DISPLAY" ] && [ -z $DONT_ASK ]; then
	Xdialog --title "$(TEXTDOMAIN=labels gettext 'Reboot')" --yesno "\
$(gettext 'Do you really want to reboot?')

$(gettext 'All applications will be closed, and all unsaved changes will be lost.')
$(gettext 'Please save all open documents before continuing.')
" 0 0 &&
	busybox reboot "$@"
else
	busybox reboot "$@"
fi

# debounce
acpi_poweroff-delay.sh &


