poweroff 596 B

1234567891011121314151617
  1. #!/bin/sh
  2. #110505 support sudo for non-root user.
  3. #120408 support minit
  4. #140622 shinobar avoid freeze on a virtual terminal
  5. [ "`whoami`" != "root" ] && exec sudo -A ${0} ${@} #110505
  6. [ "$DISPLAY" ] && which wmpoweroff &>/dev/null && exec wmpoweroff #avoid freeze on a virtual terminal
  7. /etc/rc.d/rc.shutdown
  8. POWEROFFEXE='/bin/busybox poweroff'
  9. #[ -f /sbin/minit ] && POWEROFFEXE='/sbin/shutdown -o' #-o means poweroff. note: shutdown is part of minit pkg.
  10. [ -f /sbin/minit ] && POWEROFFEXE='hard-reboot POWER_OFF' #note: hard-reboot is part of minit pkg.
  11. exec ${POWEROFFEXE} #>/dev/null 2>&1