Update scripts
This commit is contained in:
parent
930c82316a
commit
e5c3183025
2
app
2
app
@ -1 +1 @@
|
||||
Subproject commit 1adf331268476405f22725518335ef49f6999fd9
|
||||
Subproject commit 836d9afe1756070971731198d39e69c78cf3b527
|
@ -129,11 +129,6 @@ void daemon_init() {
|
||||
unlink("/data/magisk_debug.log");
|
||||
chmod("/data/adb", 0700);
|
||||
|
||||
// Use shell glob to match files
|
||||
exec_command_sync("sh", "-c",
|
||||
"mv -f /data/adb/magisk/stock_*.img.gz /data;"
|
||||
"rm -f /data/user*/*/magisk.db;", NULL);
|
||||
|
||||
LOGI("* Creating /sbin overlay");
|
||||
DIR *dir;
|
||||
struct dirent *entry;
|
||||
|
@ -13,8 +13,6 @@
|
||||
main() {
|
||||
# Magisk binaries
|
||||
MAGISKBIN=/data/adb/magisk
|
||||
# This script always runs in recovery
|
||||
BOOTMODE=false
|
||||
|
||||
mount /data 2>/dev/null
|
||||
|
||||
@ -41,7 +39,6 @@ main() {
|
||||
|
||||
remove_system_su
|
||||
|
||||
find_boot_image
|
||||
[ -z $BOOTIMAGE ] && abort "! Unable to detect boot image"
|
||||
ui_print "- Found boot image: $BOOTIMAGE"
|
||||
|
||||
@ -59,13 +56,6 @@ main() {
|
||||
mv stock_boot* /data
|
||||
fi
|
||||
|
||||
patch_dtbo_image
|
||||
|
||||
if [ -f stock_dtbo* ]; then
|
||||
rm -f /data/stock_dtbo* 2>/dev/null
|
||||
mv stock_dtbo* /data
|
||||
fi
|
||||
|
||||
cd /
|
||||
recovery_cleanup
|
||||
|
||||
|
@ -83,8 +83,6 @@ chmod -R 755 .
|
||||
# Unpack
|
||||
##########################################################################################
|
||||
|
||||
migrate_boot_backup
|
||||
|
||||
CHROMEOS=false
|
||||
|
||||
ui_print "- Unpacking boot image"
|
||||
|
@ -13,10 +13,6 @@
|
||||
# Preparation
|
||||
##########################################################################################
|
||||
|
||||
# Detect whether in boot mode
|
||||
ps | grep zygote | grep -v grep >/dev/null && BOOTMODE=true || BOOTMODE=false
|
||||
$BOOTMODE || ps -A 2>/dev/null | grep zygote | grep -v grep >/dev/null && BOOTMODE=true
|
||||
|
||||
# This path should work in any cases
|
||||
TMPDIR=/dev/tmp
|
||||
|
||||
@ -24,7 +20,6 @@ INSTALLER=$TMPDIR/install
|
||||
COMMONDIR=$INSTALLER/common
|
||||
APK=$COMMONDIR/magisk.apk
|
||||
CHROMEDIR=$INSTALLER/chromeos
|
||||
COREDIR=/magisk/.core
|
||||
|
||||
# Default permissions
|
||||
umask 022
|
||||
@ -83,8 +78,8 @@ if is_mounted /data; then
|
||||
chmod 700 /data/adb 2>/dev/null
|
||||
|
||||
# Some legacy migration
|
||||
mv /data/magisk/stock_boot* /data 2>/dev/null
|
||||
[ -L /data/magisk.img ] || mv /data/magisk.img /data/adb/magisk.img
|
||||
run_migrations
|
||||
[ -L /data/magisk.img ] || mv /data/magisk.img /data/adb/magisk.img 2>/dev/null
|
||||
else
|
||||
MAGISKBIN=/cache/data_bin
|
||||
fi
|
||||
@ -113,7 +108,6 @@ $BOOTMODE || recovery_actions
|
||||
[ -z $BOOTIMAGE ] && abort "! Unable to detect boot image"
|
||||
ui_print "- Found boot image: $BOOTIMAGE"
|
||||
|
||||
find_dtbo_image
|
||||
if [ ! -z $DTBOIMAGE ]; then
|
||||
ui_print "- Found dtbo image: $DTBOIMAGE"
|
||||
# Disable dtbo patch by default
|
||||
|
@ -34,20 +34,16 @@ fi
|
||||
if $BOOTMODE; then
|
||||
# Load utility functions
|
||||
. $MAGISKBIN/util_functions.sh
|
||||
BOOTMODE=true
|
||||
boot_actions
|
||||
mount_partitions
|
||||
fi
|
||||
|
||||
cd $MAGISKBIN
|
||||
|
||||
# Find the boot image
|
||||
find_boot_image
|
||||
[ -z $BOOTIMAGE ] && abort "! Unable to detect boot image"
|
||||
|
||||
ui_print "- Found Boot Image: $BOOTIMAGE"
|
||||
|
||||
migrate_boot_backup
|
||||
|
||||
ui_print "- Unpacking boot image"
|
||||
./magiskboot --unpack "$BOOTIMAGE"
|
||||
CHROMEOS=false
|
||||
|
@ -10,6 +10,11 @@
|
||||
#MAGISK_VERSION_STUB
|
||||
SCRIPT_VERSION=$MAGISK_VER_CODE
|
||||
|
||||
# Detect whether in boot mode
|
||||
ps | grep zygote | grep -v grep >/dev/null && BOOTMODE=true || BOOTMODE=false
|
||||
$BOOTMODE || ps -A 2>/dev/null | grep zygote | grep -v grep >/dev/null && BOOTMODE=true
|
||||
$BOOTMODE || id | grep -q 'uid=0' || BOOTMODE=true
|
||||
|
||||
# Default location, will override if needed
|
||||
MAGISKBIN=/data/adb/magisk
|
||||
[ -z $MOUNTPATH ] && MOUNTPATH=/sbin/.core/img
|
||||
@ -47,7 +52,12 @@ mount_partitions() {
|
||||
SLOT=_`getprop ro.boot.slot`
|
||||
[ $SLOT = "_" ] && SLOT=
|
||||
fi
|
||||
|
||||
# Check the boot image to make sure the slot actually make sense
|
||||
find_boot_image
|
||||
find_dtbo_image
|
||||
[ -z $SLOT ] || ui_print "- A/B partition detected, current slot: $SLOT"
|
||||
|
||||
ui_print "- Mounting /system, /vendor"
|
||||
is_mounted /system || [ -f /system/build.prop ] || mount -o ro /system 2>/dev/null
|
||||
if ! is_mounted /system && ! [ -f /system/build.prop ]; then
|
||||
@ -105,7 +115,10 @@ find_boot_image() {
|
||||
BOOTIMAGE=
|
||||
if [ ! -z $SLOT ]; then
|
||||
BOOTIMAGE=`find /dev/block -iname boot$SLOT | head -n 1` 2>/dev/null
|
||||
else
|
||||
fi
|
||||
if [ -z "$BOOTIMAGE" ]; then
|
||||
# The slot info is incorrect...
|
||||
SLOT=
|
||||
for BLOCK in boot_a kern-a android_boot kernel boot lnx bootimg; do
|
||||
BOOTIMAGE=`find /dev/block -iname $BLOCK | head -n 1` 2>/dev/null
|
||||
[ ! -z $BOOTIMAGE ] && break
|
||||
@ -118,10 +131,10 @@ find_boot_image() {
|
||||
[ ! -z $BOOTIMAGE ] && break
|
||||
done
|
||||
fi
|
||||
BOOTIMAGE=`resolve_link $BOOTIMAGE`
|
||||
[ ! -z "$BOOTIMAGE" ] && BOOTIMAGE=`resolve_link $BOOTIMAGE`
|
||||
}
|
||||
|
||||
migrate_boot_backup() {
|
||||
run_migrations() {
|
||||
# Update the broken boot backup
|
||||
if [ -f /data/stock_boot_.img.gz ]; then
|
||||
$MAGISKBIN/magiskboot --decompress /data/stock_boot_.img.gz /data/stock_boot.img
|
||||
@ -134,8 +147,17 @@ migrate_boot_backup() {
|
||||
mv /data/stock_boot.img $STOCKDUMP
|
||||
$MAGISKBIN/magiskboot --compress $STOCKDUMP
|
||||
fi
|
||||
# Move the stock backups
|
||||
if [ -f /data/magisk/stock_boot* ]; then
|
||||
rm -rf /data/stock_boot*
|
||||
mv /data/magisk/stock_boot* /data 2>/dev/null
|
||||
mv /data/magisk/adb/stock_boot* /data 2>/dev/null
|
||||
fi
|
||||
if [ -f /data/adb/magisk/stock_boot* ]; then
|
||||
rm -rf /data/stock_boot*
|
||||
mv /data/adb/magisk/stock_boot* /data 2>/dev/null
|
||||
fi
|
||||
# Remove old dbs
|
||||
rm -f /data/user*/*/magisk.db
|
||||
}
|
||||
|
||||
flash_boot_image() {
|
||||
|
Loading…
Reference in New Issue
Block a user