Allow upgrade Magisk daemon in emulator

This commit is contained in:
topjohnwu 2019-10-21 13:58:57 -04:00
parent 271b0287d8
commit 953c40b083

View File

@ -36,7 +36,6 @@ if [ ! -f /system/build.prop ]; then
else else
adb push native/out/x86/magiskinit /data/local/tmp adb push native/out/x86/magiskinit /data/local/tmp
fi fi
adb root || abort 'adb root failed'
adb shell sh /data/local/tmp/emulator.sh adb shell sh /data/local/tmp/emulator.sh
exit 0 exit 0
fi fi
@ -45,12 +44,10 @@ cd /data/local/tmp
chmod 777 busybox chmod 777 busybox
chmod 777 magiskinit chmod 777 magiskinit
# Emulator's adb shell should have root if [ `./busybox id -u` -ne 0 ]; then
[ `./busybox id -u` -eq 0 ] || abort 'ADB shell should have root access' # Re-run script with root
exec /system/xbin/su 0 sh $0
# Check whether already setup fi
[ -f /sbin/magisk ] && abort "Magisk is already setup"
./busybox pgrep magiskd && abort "Magisk is already setup"
# First setup a good env to work with # First setup a good env to work with
rm -rf bin rm -rf bin
@ -59,6 +56,10 @@ rm -rf bin
OLD_PATH="$PATH" OLD_PATH="$PATH"
PATH="/data/local/tmp/bin:$PATH" PATH="/data/local/tmp/bin:$PATH"
# Remove previous setup if exist
pgrep magiskd >/dev/null && pkill -9 magiskd
[ -f /sbin/magisk ] && umount -l /sbin
# SELinux stuffs # SELinux stuffs
[ -e /sys/fs/selinux ] && SELINUX=true || SELINUX=false [ -e /sys/fs/selinux ] && SELINUX=true || SELINUX=false
if $SELINUX; then if $SELINUX; then