#!/usr/bin/env bash ############################################################################### # # Copyright (C) 2009-2013 Nintendo. All rights reserved. # # These coded instructions, statements, and computer programs contain # proprietary information of Nintendo of America Inc. and/or Nintendo # Company Ltd., and are protected by Federal copyright law. They may # not be disclosed to third parties or copied or duplicated in any form, # in whole or in part, without the prior written consent of Nintendo. # ############################################################################### ############################################################################### # print usage help message ############################################################################### usage () { cat < : path to update package (from sysconfig's perspective) -s : use system updater (update package should contain system updater) -t : patch to single title (from sysconfig's perspective) -P : Use production bootloader (only applies when in NAND boot mode) EOF } ############################################################################### # main ############################################################################### if [ "$USE_CAFEX" == "1" ] then # Set IFS to something that will not be in the args, so that BASH will pass the entire un-parsed string to CafeX saveIFS="$IFS" IFS=$'\n' echo "Using CafeControl" cafex.exe update $@ rval=$? IFS="$saveIFS" exit $rval fi # stop the script when any command returns an error (non-zero). set -e CAFEUPDATE_USE_SYSTEM_UPDATER=0 CAFEUPDATE_TITLE= CAFEUPDATE_PACKAGE_DEFAULT="/vol/storage_hfiomlc01/sys/update/pcfs" CAFEUPDATE_PACKAGE="$CAFEUPDATE_PACKAGE_DEFAULT" USE_MIXED_BOOTLOADER=1 # init options while getopts hu:st:qP OPT do case $OPT in u ) CAFEUPDATE_PACKAGE="$OPTARG";; s ) CAFEUPDATE_USE_SYSTEM_UPDATER=1;; t ) CAFEUPDATE_TITLE="$OPTARG";; P ) if [ "$CAFE_BOOT_MODE" == "NAND" ] then USE_MIXED_BOOTLOADER=0 else echo "Warning: -P switch only applies to NAND mode. Ignored." fi ;; h ) usage exit;; \:) echo "cafeupdate failed: missing argument" >&2 usage exit;; \?) echo "cafeupdate failed" >&2 usage exit;; esac done shift $(($OPTIND-1)) if [ "${SDK_MAJ_VER}.${SDK_MIN_VER}.${SDK_MIC_VER}" != "${SDK_VER//0/}" ]; then "$CAFE_ROOT\system\bin\tool\mionps" $BRIDGE_CURRENT_IP_ADDRESS 3 -s ${SDK_VER:0:1} "$CAFE_ROOT\system\bin\tool\mionps" $BRIDGE_CURRENT_IP_ADDRESS 4 -s ${SDK_VER:2:2} "$CAFE_ROOT\system\bin\tool\mionps" $BRIDGE_CURRENT_IP_ADDRESS 5 -s ${SDK_VER:5:2} fi if [ "$CAFE_BOOT_MODE" == "NAND" ]; then if [ $USE_MIXED_BOOTLOADER -eq 1 ]; then echo Calling caferecover for NAND"..." caferecover else echo Calling caferecover -production for NAND"..." caferecover -production fi export CAFE_BOOT_MODE=NAND else if [ "${CAFE_HARDWARE:0:2}" == "ev" -o "$CAFE_SECURITY" = "off" ] then echo "Sorry, bringup boot1 update not supported yet" exit 0 fi if [ -n "$CAFEUPDATE_TITLE" ] then echo "Installing title $CAFEUPDATE_TITLE using System Config Tool..." cafeon -c "install $CAFEUPDATE_TITLE" -c exit else if [ "$CAFEUPDATE_PACKAGE" == "$CAFEUPDATE_PACKAGE_DEFAULT" ] then echo "Performing system update using System Config Tool..." else echo "Performing system update using System Config Tool from $CAFEUPDATE_PACKAGE..." fi if [ $CAFEUPDATE_USE_SYSTEM_UPDATER -eq 1 ] then echo "Using system updater..." cafeon -c "update_launch $CAFEUPDATE_PACKAGE" else echo "Sourcing script setbootmode PCFS..." source setbootmode PCFS fi sed -i -e "s|\(\)\(.*\)\(\)|\1system_config_tool.rpx\3|" "$CAFE_DATA_DIR/mlc/sys/title/00050010/1f700500/code/cos.xml" fi fi