| #!/bin/sh |
| # |
| # Set the PS3 boot flag and reboot to game OS. |
| # |
| # Copyright (C) 2006 Sony Computer Entertainment Inc. |
| # Copyright 2006 Sony Corp. |
| # |
| # This program is free software; you can redistribute it and/or modify |
| # it under the terms of the GNU General Public License as published by |
| # the Free Software Foundation; version 2 of the License. |
| # |
| # This program is distributed in the hope that it will be useful, |
| # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| # GNU General Public License for more details. |
| # |
| # You should have received a copy of the GNU General Public License |
| # along with this program; if not, write to the Free Software |
| # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| # |
| |
| usage() { |
| echo "ps3-boot-game-os (@PACKAGE_NAME@) @PACKAGE_VERSION@" >&2 |
| echo "DESCRIPTION" >&2 |
| echo " The ps3-boot-game-os utility will set the system boot flag to Game OS and" >&2 |
| echo " reboot the system. The system will reboot into the Game OS." >&2 |
| echo "OPTIONS" >&2 |
| echo " -n, --no-reboot" >&2 |
| echo " Don't reboot system after setting boot flag." >&2 |
| echo " -p, --poweroff" >&2 |
| echo " Poweroff system after setting boot flag." >&2 |
| echo " -h, --help" >&2 |
| echo " Print a help message." >&2 |
| echo " -V, -version" >&2 |
| echo " Display the program version number." >&2 |
| echo "SEE ALSO" >&2 |
| echo " ps3-flash-util(8)" >&2 |
| echo "Send bug reports to @PACKAGE_BUGREPORT@" >&2 |
| exit 1 |
| } |
| |
| version() { |
| echo "ps3-boot-game-os (@PACKAGE_NAME@) @PACKAGE_VERSION@" |
| exit 1 |
| } |
| |
| cmd="reboot" |
| |
| while [ "$#" -gt 0 ]; do |
| case "$1" in |
| -n | --no-reboot) |
| cmd="no-reboot" |
| ;; |
| -p | --poweroff) |
| cmd="poweroff" |
| ;; |
| --version | -V) |
| version |
| ;; |
| *) |
| usage |
| ;; |
| esac |
| shift |
| done |
| |
| |
| if ! @prefix@/sbin/ps3-flash-util -g ; then |
| echo "ERROR: can't change boot flag" >&2; |
| exit 1; |
| fi |
| |
| echo $cmd 2>&1; |
| |
| if [ $cmd = "poweroff" ]; then |
| poweroff |
| elif [ $cmd = "no-reboot" ]; then |
| exit 0 |
| else |
| reboot |
| fi |