reboot 730 B

1234567891011121314151617181920
  1. #!/bin/sh
  2. #110505 support sudo for non-root user.
  3. #120408 support minit
  4. #140622 shinobar avoid freeze on a virtual terminal, skip shutdownconfig
  5. . /etc/rc.d/PUPSTATE
  6. [ "$PUPMODE" = "5" ] && [ $PPID -eq 1 ] && touch /tmp/shutdownconfig_results && sync #skip shutdownconfig
  7. [ "`whoami`" != "root" ] && exec sudo -A ${0} ${@} #110505
  8. [ "$DISPLAY" ] && which wmreboot &>/dev/null && exec wmreboot #avoid freeze on a virtual terminal
  9. /etc/rc.d/rc.shutdown
  10. REBOOTEXE='/bin/busybox reboot'
  11. #[ -f /sbin/minit ] && REBOOTEXE='/sbin/shutdown -r' #-r means reboot. note, shutdown is part of minit pkg.
  12. [ -f /sbin/minit ] && REBOOTEXE='hard-reboot RESTART' #note, hard-reboot is part of minit pkg.
  13. exec ${REBOOTEXE} #>/dev/null 2>&1