Skip to content

Instantly share code, notes, and snippets.

@docwhat
Created June 10, 2022 18:49
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save docwhat/bcc6bea29ea8f5e0de04d29cc9964532 to your computer and use it in GitHub Desktop.
Script to update MiniUI for the Miyoo Mini
#!/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