mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-06-12 21:27:41 +02:00
Merge Magisk install zip into Magisk Manager
Distribute Magisk directly with Magisk Manager APK. The APK will contain all required binaries and scripts for installation and uninstallation. App versions will now align with Magisk releases. Extra effort is spent to make the APK itself also a flashable zip that can be used in custom recoveries, so those still prefer to install Magisk with recoveries will not be affected with this change. As a bonus, this makes the whole installation and uninstallation process 100% offline. The existing Magisk Manager was not really functional without an Internet connection, as the installation process was highly tied to zips hosted on the server. An additional bonus: since all binaries are now shipped as "native libraries" of the APK, we can finally bump the target SDK version higher than 28. The target SDK version was stuck at 28 for a long time because newer SELinux restricts running executables from internal storage. More details can be found here: https://github.com/termux/termux-app/issues/1072 The target SDK bump will be addressed in a future commit. Co-authored with @vvb2060
This commit is contained in:
@ -1,37 +1,18 @@
|
||||
#!/sbin/sh
|
||||
X86_CNT=__X86_CNT__
|
||||
extract_bb() {
|
||||
touch "$BBBIN"
|
||||
chmod 755 "$BBBIN"
|
||||
dd if="$0" of="$BBBIN" bs=1024 skip=1 count=$X86_CNT
|
||||
"$BBBIN" >/dev/null 2>&1 || dd if="$0" of="$BBBIN" bs=1024 skip=$(($X86_CNT + 1))
|
||||
}
|
||||
setup_bb() {
|
||||
mkdir -p $TMPDIR 2>/dev/null
|
||||
BBBIN=$TMPDIR/busybox
|
||||
extract_bb
|
||||
}
|
||||
export BBBIN
|
||||
case "$1" in
|
||||
"extract"|"-x")
|
||||
BBBIN=./busybox
|
||||
[ -z "$2" ] || BBBIN="$2"
|
||||
extract_bb
|
||||
;;
|
||||
"sh")
|
||||
TMPDIR=.
|
||||
setup_bb
|
||||
shift
|
||||
exec ./busybox sh -o standalone "$@"
|
||||
;;
|
||||
*)
|
||||
TMPDIR=/dev/tmp
|
||||
rm -rf $TMPDIR 2>/dev/null
|
||||
setup_bb
|
||||
export INSTALLER=$TMPDIR/install
|
||||
$BBBIN mkdir -p $INSTALLER
|
||||
$BBBIN unzip -o "$3" -d $INSTALLER >&2
|
||||
exec $BBBIN sh -o standalone $INSTALLER/META-INF/com/google/android/updater-script "$@"
|
||||
;;
|
||||
esac
|
||||
exit
|
||||
|
||||
TMPDIR=/dev/tmp
|
||||
rm -rf $TMPDIR
|
||||
mkdir -p $TMPDIR 2>/dev/null
|
||||
|
||||
export BBBIN=$TMPDIR/busybox
|
||||
unzip -o "$3" lib/x86/libbusybox.so lib/armeabi-v7a/libbusybox.so -d $TMPDIR >&2
|
||||
chmod -R 755 $TMPDIR/lib
|
||||
mv -f $TMPDIR/lib/x86/libbusybox.so $BBBIN
|
||||
$BBBIN >/dev/null 2>&1 || mv -f $TMPDIR/lib/armeabi-v7a/libbusybox.so $BBBIN
|
||||
$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
|
||||
exec $BBBIN sh "$INSTALLER/META-INF/com/google/android/updater-script" "$@"
|
||||
|
Reference in New Issue
Block a user