1#!/usr/bin/bash 2 3############################################################################### 4# 5# Copyright (C) 2009-2013 Nintendo. All rights reserved. 6# 7# These coded instructions, statements, and computer programs contain 8# proprietary information of Nintendo of America Inc. and/or Nintendo 9# Company Ltd., and are protected by Federal copyright law. They may 10# not be disclosed to third parties or copied or duplicated in any form, 11# in whole or in part, without the prior written consent of Nintendo. 12# 13############################################################################### 14 15source $(dirname "$0")/xmain.sh 16#============================== 17#UNINSTALL TITLE 18#This script uninstalls a title 19#from either USB or MLC 20# 21#VERSION 1.9 22#============================== 23 24displayHelp(){ 25 echo 'Debug RPX Script 26Required Options: 27 -t <hex chars> : Title ID to uninstall 28Optional Options: 29 -n : Title is on NAND (default: USB) 30 -d <num> : Dev number 31 --help 32 -h 33 --h 34 -help : Display help 35 36Example: 37'$(basename "$0")' -t 5000011000000' 38 exit $1 39} 40if [ $# == 0 ];then 41 displayHelp 1 42fi 43 44#get flags needed 45_initFlags 46 47#read user input 48tmp=("$@") 49for((i=0;i<$#;++i));do 50 case "${tmp[i]}" in 51 52 #obtain Title ID 53 -t)if [ $((++i)) -ge $# ];then 54 break 55 fi 56 TID="${tmp[i]}" 57 verifyTID;; 58 59 60 #obtain dev number 61 -d)if [ $((++i)) -ge $# ];then 62 break 63 fi 64 DEV="${tmp[i]}" 65 #verify DEV ID input 66 let DEV=DEV 67 if `not_numeric "$DEV"`;then 68 die Device number has to be numeric 69 fi 70 if [[ $? != 0 && "$DEV" != 0 ]];then 71 exit 1 72 fi 73 if [[ "$DEV" -le 0 || "$DEV" -gt 128 ]];then 74 die Device number must be 1 - 128 75 fi;; 76 77 78 #uninstall title on NAND 79 -n)FLG=$((FLG|TITLE_MLC));; 80 #display help and exit 81 -h|--h|-help|--help) 82 displayHelp 0;; 83 esac 84done 85i= 86 87if [ -z "$TID" ];then 88 die You must specify a title id to uninstall 89fi 90 91#make sure DEV ID is at least 2 characters 92if [ -z "$DEV" ];then 93 DEV=01 94else 95 if [ "$DEV" -le 9 ];then 96 DEV=0"$DEV" 97 fi 98 #only 1 MLC volume 99 if [[ "$DEV" != 01 && $((FLG&TITLE_MLC)) != 0 ]];then 100 die You cannot specify a device number for MLC 101 fi 102fi 103 104#pad TID 105padTID 106 107echo -ne Writing custom devmenu scripts... 108#make a custom script 109openSCP 110 111#usb or mlc? 112if [ $((FLG&TITLE_MLC)) == 0 ];then 113 i=usb 114else 115 i=mlc 116fi 117 118#write custom script 119writeSCP "uninstall /vol/storage_$i$DEV/usr/title/${TID:0:8}/${TID:8}" 120echo done! 121 122echo Running devmenu... 123#execute and close custom script 124runSCP 125echo ' 126'done! 127