Support new 1500 template
This commit is contained in:
parent
84ffdf0ed5
commit
74da6e1dc0
@ -392,15 +392,16 @@ static void simple_mount(const char *path) {
|
||||
* Miscellaneous *
|
||||
*****************/
|
||||
|
||||
#define alt_img ((char *[]) \
|
||||
{ "/cache/magisk.img", "/data/magisk_merge.img", "/data/adb/magisk_merge.img", NULL })
|
||||
|
||||
static int prepare_img() {
|
||||
// First merge images
|
||||
if (merge_img("/cache/magisk.img", MAINIMG)) {
|
||||
LOGE("Image merge /cache/magisk.img -> " MAINIMG " failed!\n");
|
||||
return 1;
|
||||
}
|
||||
if (merge_img("/data/magisk_merge.img", MAINIMG)) {
|
||||
LOGE("Image merge /data/magisk_merge.img -> " MAINIMG " failed!\n");
|
||||
return 1;
|
||||
// Merge images
|
||||
for (int i = 0; alt_img[i]; ++i) {
|
||||
if (merge_img(alt_img[i], MAINIMG)) {
|
||||
LOGE("Image merge %s -> " MAINIMG " failed!\n", alt_img[i]);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (access(MAINIMG, F_OK) == -1) {
|
||||
|
@ -11,7 +11,9 @@
|
||||
SCRIPT_VERSION=$MAGISK_VER_CODE
|
||||
|
||||
# Default location, will override if needed
|
||||
[ -d /data/adb/magisk ] && MAGISKBIN=/data/adb/magisk || MAGISKBIN=/data/magisk
|
||||
MAGISKBIN=/data/adb/magisk
|
||||
[ -z $MAGISKBIN ] && MOUNTPATH=/sbin/.core/img
|
||||
[ -z $IMG ] && IMG=/data/adb/magisk.img
|
||||
|
||||
BOOTSIGNER="/system/bin/dalvikvm -Xnodex2oat -Xnoimage-dex2oat -cp \$APK com.topjohnwu.magisk.utils.BootSigner"
|
||||
BOOTSIGNED=false
|
||||
@ -333,3 +335,36 @@ image_size_check() {
|
||||
curFreeM=$((curSizeM - curUsedM))
|
||||
}
|
||||
|
||||
mount_magisk_img() {
|
||||
[ -z reqSizeM ] && reqSizeM=0
|
||||
if [ -f "$IMG" ]; then
|
||||
ui_print "- Found $IMG"
|
||||
image_size_check $IMG
|
||||
if [ "$reqSizeM" -gt "$curFreeM" ]; then
|
||||
newSizeM=$(((reqSizeM + curUsedM) / 32 * 32 + 64))
|
||||
ui_print "- Resizing $IMG to ${newSizeM}M"
|
||||
$MAGISKBIN/magisk --resizeimg $IMG $newSizeM >&2
|
||||
fi
|
||||
else
|
||||
newSizeM=$((reqSizeM / 32 * 32 + 64));
|
||||
ui_print "- Creating $IMG with size ${newSizeM}M"
|
||||
$MAGISKBIN/magisk --createimg $IMG $newSizeM >&2
|
||||
fi
|
||||
|
||||
ui_print "- Mounting $IMG to $MOUNTPATH"
|
||||
MAGISKLOOP=`$MAGISKBIN/magisk --mountimg $IMG $MOUNTPATH`
|
||||
is_mounted $MOUNTPATH || abort "! $IMG mount failed..."
|
||||
}
|
||||
|
||||
unmount_magisk_img() {
|
||||
$MAGISKBIN/magisk --umountimg $MOUNTPATH $MAGISKLOOP
|
||||
|
||||
# Shrink the image if possible
|
||||
image_size_check $IMG
|
||||
newSizeM=$((curUsedM / 32 * 32 + 64))
|
||||
if [ $curSizeM -gt $newSizeM ]; then
|
||||
ui_print "- Shrinking $IMG to ${newSizeM}M"
|
||||
$MAGISKBIN/magisk --resizeimg $IMG $newSizeM
|
||||
fi
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user