#!/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. # ############################################################################### # We need to check if the script was called with or without source, # so we can either return or exit the proper codes. ############################################################## sourced() { if [ "${FUNCNAME[1]}" = source ] then return 0 else return 1 fi } ############################################################## ############################################################## # main ############################################################## # The script's return/exit variable rval=0 # Find pcfsserver.exe if [ -f "$MION_BRIDGE_TOOLS/PCFS/PCFSServer.exe" ] then PCFSSERVER_EXE="$MION_BRIDGE_TOOLS/PCFS/PCFSServer.exe" else PCFSSERVER_EXE="PCFSServer.exe" fi if [ "$USE_CAFEX" == "1" ] then saveIFS="$IFS" IFS=$'\n' cafex.exe stop $@ rval=$? IFS="$saveIFS" export CAFESTOP_STATUS=$rval elif [ "$1" = "-hostonly" -o -z "$MION_BRIDGE_TOOLS" -o -z "$BRIDGE_CURRENT_IP_ADDRESS" ] then # We want to kill any running processes, but don't want to talk to a (non-existent?) device ToucanReset -stop "$PCFSSERVER_EXE" -q rval=0 else export PLATFORM=cafe HARD_STOP=0 if [ "$1" = "-hard" ] then HARD_STOP=1 shift fi # Assume CAFERUN_OPTION_SOFT_LAUNCH is set in caferun or autotest script if [ "$CAFERUN_OPTION_SOFT_LAUNCH" = "1" -a $HARD_STOP -eq 0 ]; then # In autotest softlaunch, cafestop is a no-op export CAFESTOP_STATUS=0 rval=$CAFESTOP_STATUS else source hoststop $@ "$PCFSSERVER_EXE" -q export CAFESTOP_STATUS=$? if [ $CAFESTOP_STATUS -ne 0 ]; then echo `basename $BASH_SOURCE` error: CAFESTOP_STATUS=$CAFESTOP_STATUS fi if [ "$HOSTSTOP_RVAL" == "0" -a "$CAFESTOP_STATUS" == "0" ]; then rval=0 else rval=1 fi fi fi # 'exit' the result only if "not sourced", since # "sourced" calls check environment variables. if ! sourced; then exit $rval fi