Add support for poweroff, halt, and reboot

This also adds more graceful shutdown to avoid data loss. This can
certainly be improved, but right now everything is mounted readonly, so
it's superfluous.