2023-07-07 13:52:58 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
Sharpii_DL="https://noahpistilli.github.io/RC24_Patcher/Sharpii"
|
2023-09-02 17:56:27 +02:00
|
|
|
|
|
|
|
epicfail () {
|
|
|
|
printf "
|
|
|
|
\x1b[31mSorry, an error occured.\x1b[0m
|
|
|
|
Here's what I know:
|
|
|
|
|
|
|
|
At line $1:
|
|
|
|
$BASH_COMMAND
|
|
|
|
|
|
|
|
\x1b[33mExit code: $2\x1b[0m
|
|
|
|
|
|
|
|
Bother \x1b[1;32m@thepikachugamer\x1b[0m on Discord about this.
|
|
|
|
|
|
|
|
"
|
|
|
|
exit
|
|
|
|
}
|
|
|
|
|
|
|
|
trap 'epicfail $LINENO $?' err
|
|
|
|
set -o errtrace
|
|
|
|
set -o pipefail
|
|
|
|
|
2023-07-07 13:52:58 +02:00
|
|
|
case $(uname -m),$(uname) in
|
2023-09-02 17:56:27 +02:00
|
|
|
x86_64,Darwin|arm64,Darwin)
|
|
|
|
sys="macOS-x64";;
|
2023-07-07 13:52:58 +02:00
|
|
|
x86_64,*)
|
|
|
|
sys="linux-x64";;
|
|
|
|
aarch64,*)
|
|
|
|
sys="linux-arm64";;
|
|
|
|
*,*)
|
|
|
|
sys="linux-arm";;
|
|
|
|
x86_32,*)
|
2023-09-02 17:56:27 +02:00
|
|
|
printf "The x86_32 architecture is not supported by Sharpii.\n"
|
|
|
|
exit;;
|
2023-07-07 13:52:58 +02:00
|
|
|
esac
|
|
|
|
|
|
|
|
download_ios () {
|
2023-09-02 17:56:27 +02:00
|
|
|
if [[ -f "ios/IOS${1}-64-v${2}.wad" ]]; then
|
|
|
|
printf " * IOS${1} appears to be downloaded already...\n"
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
printf "Downloading IOS${1}...\n"
|
|
|
|
./Sharpii nusd -ios ${1} -v ${2} -wad -o ios/IOS${1}-64-v${2}.wad &>/dev/null
|
2023-07-07 13:52:58 +02:00
|
|
|
}
|
|
|
|
|
2023-09-02 17:56:27 +02:00
|
|
|
if [[ -f "sharpii($sys)" ]]; then mv "sharpii($sys)" "Sharpii"; fi
|
2023-07-07 13:52:58 +02:00
|
|
|
|
2023-09-02 17:56:27 +02:00
|
|
|
if ! [[ -f "Sharpii" ]]; then
|
|
|
|
if ! command -v curl &> /dev/null; then
|
|
|
|
printf >&2 "Cannot find Sharpii nor curl to try download it.\n\n"
|
|
|
|
printf >&2 "Either install curl with your package manager, or manually download it from $Sharpii_DL/sharpii($sys) .\n"
|
2023-07-07 13:52:58 +02:00
|
|
|
exit
|
|
|
|
else
|
2023-09-02 17:56:27 +02:00
|
|
|
printf "Downloading Sharpii...\n"
|
2023-07-07 13:52:58 +02:00
|
|
|
curl -f -s -o "Sharpii" "$Sharpii_DL/sharpii($sys)"
|
|
|
|
fi
|
|
|
|
fi
|
2023-09-02 17:56:27 +02:00
|
|
|
if ! [[ -x "Sharpii" ]]; then chmod +x Sharpii 2> /dev/null; fi
|
|
|
|
|
|
|
|
mkdir -p ios
|
|
|
|
printf "This script downloads the 4 IOS WADs at wii.guide/cios mentioned at Section I.\n"
|
2023-07-07 13:52:58 +02:00
|
|
|
sleep 1
|
|
|
|
download_ios 38 4123
|
|
|
|
download_ios 56 5661
|
|
|
|
download_ios 57 5918
|
|
|
|
download_ios 58 6175
|
|
|
|
|
2023-09-02 17:56:27 +02:00
|
|
|
printf "\n\x1b[1;34mAll done!\x1b[0m\n"
|
|
|
|
if [[ -f "d2x_offline_ios.sh" ]]; then
|
|
|
|
printf "There should be an ios folder located next to this script.\n"
|
|
|
|
else
|
|
|
|
printf "There should be an ios folder located in $(pwd).\n"
|
|
|
|
fi
|
|
|
|
printf "Move the four WAD files in it to the root of the device \nthat contains the d2x-cIOS-installer.\n\n"
|
2023-07-07 13:52:58 +02:00
|
|
|
|