mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-22 16:07:39 +00:00
parent
5604074eba
commit
e6bd2ff60f
@ -78,7 +78,7 @@ run_uninstaller() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
restore_imgs() {
|
restore_imgs() {
|
||||||
[ -z $SHA1 ] && return 1
|
local SHA1=$(grep_prop SHA1 $MAGISKTMP/.magisk/config)
|
||||||
local BACKUPDIR=/data/magisk_backup_$SHA1
|
local BACKUPDIR=/data/magisk_backup_$SHA1
|
||||||
[ -d $BACKUPDIR ] || return 1
|
[ -d $BACKUPDIR ] || return 1
|
||||||
|
|
||||||
@ -232,7 +232,6 @@ app_init() {
|
|||||||
check_boot_ramdisk && RAMDISKEXIST=true
|
check_boot_ramdisk && RAMDISKEXIST=true
|
||||||
get_flags >/dev/null
|
get_flags >/dev/null
|
||||||
run_migrations >/dev/null
|
run_migrations >/dev/null
|
||||||
SHA1=$(grep_prop SHA1 $MAGISKTMP/.magisk/config)
|
|
||||||
check_encryption
|
check_encryption
|
||||||
|
|
||||||
# Dump variables
|
# Dump variables
|
||||||
|
@ -530,7 +530,7 @@ check_data() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
run_migrations() {
|
run_migrations() {
|
||||||
local LOCSHA1
|
local SHA1
|
||||||
local TARGET
|
local TARGET
|
||||||
# Legacy app installation
|
# Legacy app installation
|
||||||
local BACKUP=$MAGISKBIN/stock_boot*.gz
|
local BACKUP=$MAGISKBIN/stock_boot*.gz
|
||||||
@ -542,22 +542,23 @@ run_migrations() {
|
|||||||
# Legacy backup
|
# Legacy backup
|
||||||
for gz in /data/stock_boot*.gz; do
|
for gz in /data/stock_boot*.gz; do
|
||||||
[ -f $gz ] || break
|
[ -f $gz ] || break
|
||||||
LOCSHA1=$(basename $gz | sed -e 's/stock_boot_//' -e 's/.img.gz//')
|
SHA1=$(basename $gz | sed -e 's/stock_boot_//' -e 's/.img.gz//')
|
||||||
[ -z $LOCSHA1 ] && break
|
[ -z $SHA1 ] && break
|
||||||
mkdir /data/magisk_backup_${LOCSHA1} 2>/dev/null
|
mkdir /data/magisk_backup_${SHA1} 2>/dev/null
|
||||||
mv $gz /data/magisk_backup_${LOCSHA1}/boot.img.gz
|
mv $gz /data/magisk_backup_${SHA1}/boot.img.gz
|
||||||
done
|
done
|
||||||
|
|
||||||
# Stock backups
|
# Stock backups
|
||||||
LOCSHA1=$SHA1
|
SHA1=
|
||||||
for name in boot dtb dtbo dtbs; do
|
for name in boot dtb dtbo dtbs; do
|
||||||
BACKUP=$MAGISKBIN/stock_${name}.img
|
BACKUP=$MAGISKBIN/stock_${name}.img
|
||||||
[ -f $BACKUP ] || continue
|
[ -f $BACKUP ] || continue
|
||||||
if [ $name = 'boot' ]; then
|
if [ $name = 'boot' ]; then
|
||||||
LOCSHA1=$($MAGISKBIN/magiskboot sha1 $BACKUP)
|
SHA1=$($MAGISKBIN/magiskboot sha1 $BACKUP)
|
||||||
mkdir /data/magisk_backup_${LOCSHA1} 2>/dev/null
|
mkdir /data/magisk_backup_${SHA1} 2>/dev/null
|
||||||
fi
|
fi
|
||||||
TARGET=/data/magisk_backup_${LOCSHA1}/${name}.img
|
[ -z $SHA1 ] && break
|
||||||
|
TARGET=/data/magisk_backup_${SHA1}/${name}.img
|
||||||
cp $BACKUP $TARGET
|
cp $BACKUP $TARGET
|
||||||
rm -f $BACKUP
|
rm -f $BACKUP
|
||||||
gzip -9f $TARGET
|
gzip -9f $TARGET
|
||||||
|
Loading…
x
Reference in New Issue
Block a user