mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-30 13:35:27 +00:00
773bf0c6bc
https://android.googlesource.com/platform/system/core/+/refs/tags/android-10.0.0_r47/libziparchive/unzip.cpp#57 unzip did not support glob before Android 11
28 lines
791 B
Bash
28 lines
791 B
Bash
#!/sbin/sh
|
|
|
|
TMPDIR=/dev/tmp
|
|
rm -rf $TMPDIR
|
|
mkdir -p $TMPDIR 2>/dev/null
|
|
|
|
export BBBIN=$TMPDIR/busybox
|
|
for arch in "x86_64" "x86" "arm64-v8a" "armeabi-v7a"; do
|
|
unzip -o "$3" "lib/$arch/libbusybox.so" -d $TMPDIR >&2
|
|
libpath="$TMPDIR/lib/$arch/libbusybox.so"
|
|
chmod 755 $libpath
|
|
if [ -x $libpath ] && $libpath >/dev/null 2>&1; then
|
|
mv -f $libpath $BBBIN
|
|
break
|
|
fi
|
|
done
|
|
$BBBIN rm -rf $TMPDIR/lib
|
|
|
|
export INSTALLER=$TMPDIR/install
|
|
$BBBIN mkdir -p $INSTALLER
|
|
$BBBIN unzip -o "$3" "assets/*" "lib/*" "META-INF/com/google/*" -x "lib/*/libbusybox.so" -d $INSTALLER >&2
|
|
export ASH_STANDALONE=1
|
|
if echo "$3" | $BBBIN grep -q "uninstall"; then
|
|
exec $BBBIN sh "$INSTALLER/assets/uninstaller.sh" "$@"
|
|
else
|
|
exec $BBBIN sh "$INSTALLER/META-INF/com/google/android/updater-script" "$@"
|
|
fi
|