Created
June 10, 2022 18:49
-
-
Save docwhat/bcc6bea29ea8f5e0de04d29cc9964532 to your computer and use it in GitHub Desktop.
Script to update MiniUI for the Miyoo Mini
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
set -eu | |
cd "${0:h}" | |
die() { | |
echo "death: $*" >&2 | |
exit | |
} | |
declare -r sdcard=/Volumes/MINIUI | |
declare -ar bdirs=( "$PWD/"*-base(/N) ) | |
declare -ar edirs=( "$PWD/"*-extras(/N) ) | |
if ! [[ -d "$sdcard/Roms" ]]; then | |
echo "** Faking it since the MiniUI sdcard doesn't seem to be mounted **" | |
rsync() { echo rsync "$@" } | |
fi | |
if (( ${#bdirs[*]} != 1 )); then | |
die "You need to unpack exactly 1 base MiniUI zip file" | |
fi | |
if (( ${#edirs[*]} != 1 )); then | |
die "You need to unpack exactly 1 extras MiniUI zip file" | |
fi | |
declare -r bdir="${bdirs[1]}" edir="${edirs[1]}" | |
## Base | |
cd "$bdir" | |
rsync -rvP --delete miyoo/ "$sdcard/miyoo/" | |
## Extras | |
cd "$edir" | |
# Various .pak dirs. | |
for i in "$sdcard"/*/*.pak(/N); do | |
f=${i:h:t} | |
j=${i:t} | |
rsync -rvP --delete $f/$j/ $i/ | |
done | |
# Update native games. | |
rsync -rvP 'Roms/Native Games (SH)/' "$sdcard"/Roms/Native\ Games\ \(SH\)/ | |
# EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment