2
0
mirror of https://github.com/topjohnwu/Magisk synced 2025-08-31 07:25:12 +00:00

Update scripts

This commit is contained in:
topjohnwu
2018-08-10 18:59:14 +08:00
parent afcb3d8f34
commit 5c1886c8f5
7 changed files with 32 additions and 36 deletions

View File

@@ -189,29 +189,25 @@ find_boot_image() {
fi
}
flash_boot_image() {
flash_image() {
# Make sure all blocks are writable
$MAGISKBIN/magisk --unlock-blocks 2>/dev/null
case "$1" in
*.gz) COMMAND="gzip -d < '$1'";;
*) COMMAND="cat '$1'";;
*.gz) COM1="$MAGISKBIN/magiskboot --decompress '$1' - 2>/dev/null";;
*) COM1="cat '$1'";;
esac
if $BOOTSIGNED; then
SIGNCOM="$BOOTSIGNER -sign"
ui_print "- Sign boot image with test keys"
COM2="$BOOTSIGNER -sign"
ui_print "- Sign image with test keys"
else
SIGNCOM="cat -"
COM2="cat -"
fi
if [ -b "$2" ]; then
eval $COM1 | eval $COM2 | cat - /dev/zero > "$2" 2>/dev/null
else
ui_print "- Not block device, storing image"
eval $COM1 | eval $COM2 > "$2" 2>/dev/null
fi
case "$2" in
/dev/block/*)
ui_print "- Flashing new boot image"
eval $COMMAND | eval $SIGNCOM | cat - /dev/zero 2>/dev/null | dd of="$2" bs=4096 2>/dev/null
;;
*)
ui_print "- Storing new boot image"
eval $COMMAND | eval $SIGNCOM | dd of="$2" bs=4096 2>/dev/null
;;
esac
}
find_dtbo_image() {