Skip to content

Instantly share code, notes, and snippets.

@sorted-bits
Created October 12, 2019 05:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sorted-bits/35ac1500505110a17714e57181275215 to your computer and use it in GitHub Desktop.
Save sorted-bits/35ac1500505110a17714e57181275215 to your computer and use it in GitHub Desktop.
assert(getprop("ro.product.device") == "charlotte" || getprop("ro.build.product") == "charlotte" ||
getprop("ro.product.device") == "kirin970" || getprop("ro.build.product") == "kirin970" || abort("E3004: This package is for device: charlotte,kirin970; this device is " + getprop("ro.product.device") + "."););
assert(huawei.verify_vendor_build_id("P") == "1");
ui_print("Target: Huawei/lineage_charlotte/charlotte:9/PQ3A.190801.002/4eade15b97:userdebug/release-keys");
ifelse(is_mounted("/system"), unmount("/system"));
package_extract_dir("install", "/tmp/install");
set_metadata_recursive("/tmp/install", "uid", 0, "gid", 0, "dmode", 0755, "fmode", 0644);
set_metadata_recursive("/tmp/install/bin", "uid", 0, "gid", 0, "dmode", 0755, "fmode", 0755);
mount("ext4", "EMMC", "/dev/block/bootdevice/by-name/system", "/system", "");
run_program("/tmp/install/bin/backuptool.sh", "backup", "/system/system");
unmount("/system");
show_progress(0.750000, 0);
ui_print("Patching system image unconditionally...");
block_image_update("/dev/block/bootdevice/by-name/system", package_extract_file("system.transfer.list"), "system.new.dat.br", "system.patch.dat") ||
abort("E1001: Failed to update system image.");
run_program("/sbin/e2fsck", "-fy", "/dev/block/bootdevice/by-name/system");
run_program("/tmp/install/bin/resize2fs_static", "/dev/block/bootdevice/by-name/system");
run_program("/sbin/e2fsck", "-fy", "/dev/block/bootdevice/by-name/system");
show_progress(0.020000, 10);
mount("ext4", "EMMC", "/dev/block/bootdevice/by-name/system", "/system", "");
run_program("/tmp/install/bin/backuptool.sh", "restore", "/system/system");
unmount("/system");
show_progress(0.050000, 5);
show_progress(0.200000, 10);
set_progress(1.000000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment