From eb809908f970d32f54e5c0c74eac4acaebd46e8a Mon Sep 17 00:00:00 2001 From: DannyAAM Date: Thu, 17 Jul 2025 21:42:28 +0800 Subject: [PATCH] merge imset9.sh into guide repo directly --- docs/_include/ish-chorus.md | 2 +- docs/public/assets/imset9.sh | 100 +++++++++++++++++++++++++++++++++++ 2 files changed, 101 insertions(+), 1 deletion(-) create mode 100644 docs/public/assets/imset9.sh diff --git a/docs/_include/ish-chorus.md b/docs/_include/ish-chorus.md index 8103701b5bfbf..7f821b47ab97f 100644 --- a/docs/_include/ish-chorus.md +++ b/docs/_include/ish-chorus.md @@ -1,6 +1,6 @@ 1. Copy the following command: ``` - wget -O - https://imset9.686178.xyz | sh + wget -O - https://3ds.hacks.guide/assets/imset9.sh | sh ``` + Tap on the box above and a Copy icon should appear 1. Open the iSH application diff --git a/docs/public/assets/imset9.sh b/docs/public/assets/imset9.sh new file mode 100644 index 0000000000000..c7f18d854eaef --- /dev/null +++ b/docs/public/assets/imset9.sh @@ -0,0 +1,100 @@ +#!/bin/sh + +# ================================================================================ +# You're not supposed to open this link directly +# Please run the following command according to the app you use +# -------- iSH -------- +# wget -O - https://3ds.hacks.guide/assets/imset9.sh | sh +# ------ a-Shell ------ +# sh -c 'curl -sL -o imset9.sh https://3ds.hacks.guide/assets/imset9.sh && sh imset9.sh ; rm imset9.sh' +# ================================================================================ + +OGPWD="$PWD" +PLATFORM=$(uname) +MACHINE=$(uname -m) +RELEASE=$(uname -r) +ENV=unknown +if [ "$PLATFORM" = "Linux" ] && [ "$MACHINE" = "i686" ] && echo "$RELEASE" | grep -q -- '-ish$'; then + ENV=ish +fi +if [ "$PLATFORM" = "Darwin" ] && echo "$MACHINE" | grep -q '^i\(Pod\|Phone\|Pad\)'; then + ENV=ashell +fi + +if [ "$ENV" = "unknown" ]; then + echo "This is only for iSH or a-Shell on iOS/iPadOS." + exit 1 +fi + +case $ENV in + "ish") + command -v python3 >/dev/null || apk add python3 + if ! command -v python3 >/dev/null; then + echo "Failed to install python3, either try again or install manually." + exit 1 + fi + ;; + "ashell") + true + ;; +esac + +case $ENV in + "ish") + MOUNT=$(mktemp -d) + mount -t ios - "$MOUNT" + sleep 1 + cd "$MOUNT" + ;; + "ashell") + if ! echo "$PWD" | grep -Fq "com.apple.filesystems.userfsd"; then + pickFolder + fi + ;; +esac + +if [ ! -f b9 ] || [ ! -f mset9.py ]; then + echo "Downloading MSET9 files..." + ZIP_API_URL="https://api.github.com/repos/hacks-guide/MSET9/releases/latest" + case $ENV in + "ish") + # works...? + #wget -O MSET9.zip $(wget -O - $ZIP_API_URL | grep -o '"https://github\.com/.\+/releases/download/.\+/.\+\.zip"' | tr -d '"') + # probably better + wget -O MSET9.zip $(wget -O - $ZIP_API_URL | python3 -c 'import json,sys;print(json.loads(sys.stdin.read())["assets"][0]["browser_download_url"])') + ;; + "ashell") + # ashell have jq by default + curl -sL -o MSET9.zip $(curl -sL $ZIP_API_URL | jq -r '.assets[0].browser_download_url') + ;; + esac + python3 -m zipfile -e MSET9.zip . + rm MSET9.zip + if [ ! -f b9 ] || [ ! -f mset9.py ]; then + echo "Unable to download MSET9 files automatically, please get them manually." + exit 1 + fi +fi + +clear +case $ENV in + "ish") + # workaround for piped script + python3 mset9.py