From 25b70cf3d86f391e0eb0a957afd060389afb4a5d Mon Sep 17 00:00:00 2001 From: urmum-69 <49879065+urmum-69@users.noreply.github.com> Date: Mon, 6 Apr 2020 17:10:12 +0000 Subject: [PATCH] Add latest version of helper script --- assets/files/helper.sh | 76 +++++++++++++++++++++++++++++++----------- 1 file changed, 57 insertions(+), 19 deletions(-) diff --git a/assets/files/helper.sh b/assets/files/helper.sh index 34e5ad40f..f255f54ee 100644 --- a/assets/files/helper.sh +++ b/assets/files/helper.sh @@ -1,7 +1,7 @@ #!/bin/bash version="v0.0.1" -helpmsg="Need further help? Send an e-mail to support@riiconnect24.net, or join the Discord server at https://discord.gg/b4Y7jfD and we'll try to assist." +helpmsg="Need further help? You can either join the Wii Mini Hacking Discord server (recommended) at https://discord.gg/6ryxnkS, the RiiConnect24 Discord server at https://discord.gg/b4Y7jfD or you can send an e-mail to support@riiconnect24.net and we'll try to assist. " # clear and greet printf "Hello $USER, and welcome to the BlueBomb helper script.\n\nThis script will automatically check you have an environment capable of utilizing BlueBomb, download required files, and automate things as much as possible to make it easier for you, the end user, to perform the BlueBomb exploit on your Wii or Wii Mini console.\n\n" | fold -s -w $(tput cols) @@ -15,7 +15,7 @@ error() { printf "An error has occurred.\n\n* Task: $task\n* Command: $BASH_COMMAND\n* Line: $1\n* Exit code: $2\n\n" | fold -s -w $(tput cols) case "$task" in - "Checking prerequisites - Internet connection" ) printf "NOTE: Please ensure that your PC has an active internet connection.\n\n" | fold -s -w $(tput cols) + "Checking prerequisites - Internet connection" | "Download and extract BlueBomb" ) printf "NOTE: Please ensure that your PC has an active internet connection capable of reaching github.com.\n\n" | fold -s -w $(tput cols) esac printf "$helpmsg\n" | fold -s -w $(tput cols) @@ -26,19 +26,30 @@ trap 'error $LINENO $?' ERR set -o pipefail set -o errtrace +credit() { + clear + printf "Credits:\n + * Fullmetal5\t\tBlueBomb exploit + * urmum_69\t\t\tScript author + * twosecslater\t\tScript author + * Commandblock6417\t\tContributor + * Terry A. Davis\t\tMotivation\n\nHave fun running homebrew on your console!\n" | fold -s -w $(tput cols) + exit +} + # receive parameters given on command line while [[ "$1" =~ ^- && ! "$1" == "--" ]]; do case $1 in -v | --version ) printf "BlueBomb helper script\nVersion: $version\n" && exit ;; -r | --region ) shift; regionIn=$1 ;; -t | --console ) shift; consoleIn=$1 ;; -s | --sysmenu ) shift; sysmenuIn=$1 ;; + -c | --credits ) credit; exit ;; -h | --help ) printf "\nUsage: $0 [options...]\n * -v --version\t\t\tDisplays the current version of the script. * -r --region \t\tAllows you to select a region without needing to interact with the script. * -t --console \tAllows you to select a console type without needing to interact with the script. - * -h --help\t\t\t\tDisplays this help message.\n\n$helpmsg\n" | fold -s -w $(tput cols) - exit - ;; + * -s --sysmenu \tAllows you to select a system menu version without needing to interact with the script. + * -h --help\t\t\t\tDisplays this help message.\n\n$helpmsg\n" | fold -s -w $(tput cols); exit ;; esac; shift; done if [[ "$1" == '--' ]]; then shift; fi @@ -61,10 +72,24 @@ else fi printf "* Detected architecture: $arch\n\n" -dependencies=("curl" "unzip" "bluetoothctl") +## detect package manager +[[ -z "$(command -v apt)" ]] && pm="apt" +[[ -z "$(command -v emerge)" ]] && pm="portage" +[[ -z "$(command -v pacman)" ]] && pm="pacman" +[[ -z "$(command -v zypper)" ]] && pm="zyp" +[[ -z "$(command -v dnf)" ]] && pm="dnf" + +dependencies=("unzip" "bluetoothctl" "wget") for i in "${dependencies[@]}"; do - [[ -z "$(command -v ${dependencies[i]})" ]] && printf "${dependencies[i]} is not installed. Please install it using your preferred package manager.\n" && exit + if [[ -z "$(command -v ${dependencies[i]})" ]]; then case "$pm" in + "apt" ) $sudo0 apt -y install ${dependencies[i]} ;; + "portage" ) $sudo0 emerge -aqv ${dependencies[i]} ;; + "pacman" ) $sudo0 pacman -S ${dependencies[i]} ;; + "zyp" ) $sudo0 zypper install ${dependencies[i]} ;; + "dnf" ) $sudo0 dnf install ${dependencies[i]};; + * ) printf "${dependencies[i]} is not installed. Please install it using your preferred package manager.\n\n$helpmsg\n" ;; + esac fi done ## detect init system @@ -87,7 +112,7 @@ download() { task="Download and extract BlueBomb" ## download zip from github mkdir -p bluebomb && cd bluebomb - curl -sL "https://github.com/Fullmetal5/bluebomb/releases/download/1.5/bluebomb1.5.zip" -o bluebomb.zip + wget -q --secure-protocol=TLSv1_2 "https://github.com/Fullmetal5/bluebomb/releases/download/1.5/bluebomb1.5.zip" -O bluebomb.zip printf "Success!\n\n* Unpacking BlueBomb... " unzip -q bluebomb.zip rm bluebomb.zip @@ -120,36 +145,49 @@ findinfos() { else if [[ -z $sysmenuIn ]]; then clear - printf "What is the system menu version of your Wii Console?\n\nIf you're not sure where to find this, follow the following instructions:\nFrom the Wii Menu, launch Wii Options (round button in the bottom left), and then launch Wii Settings. On the first page of the Wii Settings at the upper right corner, you should see 'Ver X.YZ'. Where 'X' and 'Y' are numbers, and 'Z' is a letter. An example is '4.3E'.\n\nPlease enter the system menu version and then press ENTER: " + printf "What is the system menu version of your Wii Console?\n\nIf you're not sure where to find this, follow the following instructions:\n\nFrom the Wii Menu, launch Wii Options (round button in the bottom left), and then launch Wii Settings. On the first page of the Wii Settings at the upper right corner, you should see 'Ver X.YZ'. Where 'X' and 'Y' are numbers, and 'Z' is a letter. An example is '4.3E'. This is your system menu version.\n\nPlease enter the system menu version and then press ENTER: " read -r sysmenuIn fi - if [[ ! ${#sysmenuIn} == 4 ]]; then unset sysmenuIn && findinfos; + if [[ ! ${#sysmenuIn} == 4 ]]; then printf "Invalid selection.\n" && unset sysmenuIn && findinfos; fi sysmenuVersions=("2_0E" "2_0J" "2_0U" "2_1E" "2_2E" "2_2J" "2_2U" "3_0E" "3_0J" "3_0U" "3_1E" "3_1J" "3_1U" "3_2E" "3_2J" "3_2U" "3_3E" "3_3J" "3_3U" "3_4E" "3_4J" "3_4U" "3_5K" "4_0E" "4_0J" "4_0U" "4_1E" "4_1J" "4_1K" "4_1U" "4_2E" "4_2J" "4_2K" "4_2U" "4_3E" "4_3J" "4_3K" "4_3U") - arg2=${sysmenuIn//[.]/_} - arg2=${arg2//[e]/E} - arg2=${arg2//[j]/J} - arg2=${arg2//[k]/K} - arg2=${arg2//[u]/U} + arg2=${sysmenuIn//./_} + arg2=${arg2^^} if [[ ! "${sysmenuVersions[@]}" =~ "${arg2}" ]]; then printf "Invalid version.\n" && unset sysmenuIn && findinfos; fi fi + confirm +} + +confirm() { + clear + printf "Alrighty, so here's what's about to go down:\n\n* Target console type: " + case "$arg1" in + "WII_SM" ) printf "Wii\n" ;; + "MINI_SM_" ) printf "Wii Mini\n" ;; + esac + [[ "$arg1" == "WII_SM" ]] && printf "* Target console system menu version: ${arg2//_/.}\n" || printf "* Target console region: $arg2\n" + printf "\nBlueBomb will be executed with the above, user-provided information.\n\nIs this alright? [y/n]: " + read -r confirmation + case "${confirmation^^}" in + "Y" | "YES" ) execute ;; + * ) unset sysmenuIn; unset consoleIn; unset regionIn; unset arg1; unset arg2; findinfos ;; + esac } execute() { clear task="Stop Bluetooth Service" - printf "* Stopping the Bluetooth service... " + printf "* Stopping the Bluetooth service... (you may be prompted for your password)\n" case "$init" in "systemd" ) $sudo0 systemctl disable --now bluetooth.service ;; "openrc" ) $sudo0 rc-service bluetooth stop ;; esac - printf "Success! (hopefully)\n\n" task="Execute BlueBomb" - printf "* Executing BlueBomb...\n" + printf "\n* Executing BlueBomb...\n" printf "$sudo0 ./bluebomb-$arch ./stage0/$arg1$arg2.bin stage1.bin\n" $sudo0 ./bluebomb-$arch ./stage0/$arg1$arg2.bin stage1.bin + credit } download findinfos -execute