mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-24 03:37:58 +00:00
Fix unable to get SHA1 value issue
This commit is contained in:
parent
25c289ad3e
commit
ce87591c62
@ -68,8 +68,8 @@ int main(int argc, char *argv[]) {
|
||||
mmap_ro(argv[2], (unsigned char **) &buf, &size);
|
||||
SHA1(sha1, buf, size);
|
||||
for (int i = 0; i < 20; ++i)
|
||||
fprintf(stderr, "%02x", sha1[i]);
|
||||
fprintf(stderr, "\n");
|
||||
printf("%02x", sha1[i]);
|
||||
printf("\n");
|
||||
munmap(buf, size);
|
||||
} else if (argc > 2 && strcmp(argv[1], "--unpack") == 0) {
|
||||
unpack(argv[2]);
|
||||
|
@ -3,11 +3,11 @@
|
||||
#
|
||||
# Magisk Boot Image Patcher
|
||||
# by topjohnwu
|
||||
#
|
||||
#
|
||||
# This script should be placed in a directory with the following files:
|
||||
#
|
||||
#
|
||||
# File name type Description
|
||||
#
|
||||
#
|
||||
# boot_patch.sh script A script to patch boot. Expect path to boot image as parameter.
|
||||
# (this file) The script will use binaries and files in its same directory
|
||||
# to complete the patching process
|
||||
@ -19,7 +19,7 @@
|
||||
# All magisk entrypoints are defined here
|
||||
# chromeos folder This folder should store all the utilities and keys to sign
|
||||
# (optional) a chromeos device, used in the tablet Pixel C
|
||||
#
|
||||
#
|
||||
# If the script is not running as root, then the input boot image should be a stock image
|
||||
# or have a backup included in ramdisk internally, since we cannot access the stock boot
|
||||
# image placed under /data we've created when previously installing
|
||||
@ -147,7 +147,7 @@ case $? in
|
||||
0 ) # Stock boot
|
||||
ui_print_wrap "- Stock boot image detected!"
|
||||
ui_print_wrap "- Backing up stock boot image"
|
||||
SHA1=`./magiskboot --sha1 "$BOOTIMAGE" | tail -n 1`
|
||||
SHA1=`./magiskboot --sha1 "$BOOTIMAGE" 2>/dev/null`
|
||||
STOCKDUMP=stock_boot_${SHA1}.img
|
||||
dd if="$BOOTIMAGE" of=$STOCKDUMP
|
||||
./magiskboot --compress $STOCKDUMP
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
# Magisk Flash Script
|
||||
# by topjohnwu
|
||||
#
|
||||
#
|
||||
# This script will detect, construct the environment for Magisk
|
||||
# It will then call boot_patch.sh to patch the boot image
|
||||
#
|
||||
@ -87,7 +87,7 @@ find_boot_image
|
||||
##########################################################################################
|
||||
|
||||
ui_print "- Constructing environment"
|
||||
|
||||
|
||||
is_mounted /data && MAGISKBIN=/data/magisk || MAGISKBIN=/cache/data_bin
|
||||
|
||||
# Copy required files
|
||||
@ -152,7 +152,7 @@ ui_print "- Found Boot Image: $BOOTIMAGE"
|
||||
|
||||
# Update our previous backup to new format if exists
|
||||
if [ -f /data/stock_boot.img ]; then
|
||||
SHA1=`$MAGISKBIN/magiskboot --sha1 /data/stock_boot.img | tail -n 1`
|
||||
SHA1=`$MAGISKBIN/magiskboot --sha1 /data/stock_boot.img 2>/dev/null`
|
||||
STOCKDUMP=/data/stock_boot_${SHA1}.img
|
||||
mv /data/stock_boot.img $STOCKDUMP
|
||||
$MAGISKBIN/magiskboot --compress $STOCKDUMP
|
||||
|
@ -3,17 +3,17 @@
|
||||
#
|
||||
# Magisk Uninstaller
|
||||
# by topjohnwu
|
||||
#
|
||||
#
|
||||
# This script can be placed in /cache/magisk_uninstaller.sh
|
||||
# The Magisk main binary will pick up the script, and uninstall itself, following a reboot
|
||||
# This script can also be used in flashable zip with the uninstaller_loader.sh
|
||||
#
|
||||
#
|
||||
# This script will try to do restoration with the following:
|
||||
# 1-1. Find and restore the original stock boot image dump (OTA proof)
|
||||
# 1-2. If 1-1 fails, restore ramdisk from the internal backup
|
||||
# (ramdisk fully restored, not OTA friendly)
|
||||
# 1-3. If 1-2 fails, it will remove added files in ramdisk, however modified files
|
||||
# are remained modified, because we have no backups. By doing so, Magisk will
|
||||
# are remained modified, because we have no backups. By doing so, Magisk will
|
||||
# not be started at boot, but this isn't actually 100% cleaned up
|
||||
# 2. Remove all Magisk related files
|
||||
# (The list is LARGE, most likely due to bad decision in early versions
|
||||
@ -84,7 +84,7 @@ esac
|
||||
|
||||
# Update our previous backup to new format if exists
|
||||
if [ -f /data/stock_boot.img ]; then
|
||||
SHA1=`./magiskboot --sha1 /data/stock_boot.img | tail -n 1`
|
||||
SHA1=`./magiskboot --sha1 /data/stock_boot.img 2>/dev/null`
|
||||
STOCKDUMP=/data/stock_boot_${SHA1}.img
|
||||
mv /data/stock_boot.img $STOCKDUMP
|
||||
./magiskboot --compress $STOCKDUMP
|
||||
|
Loading…
x
Reference in New Issue
Block a user