assert(getprop("ro.product.device") == "gtelwifiue" || getprop("ro.build.product") == "gtelwifiue" || getprop("ro.product.device") == "samsung_sm_t560nu" || getprop("ro.build.product") == "samsung_sm_t560nu" || getprop("ro.product.device") == "t560nu" || getprop("ro.build.product") == "t560nu" || abort("E3004: This package is for device: gtelwifiue,samsung_sm_t560nu,t560nu; this device is " + getprop("ro.product.device") + "."););
ui_print("Target: samsung/lineage_gtelwifiue/gtelwifiue:7.1.2/NJH47B/07a403e085:userdebug/test-keys");
ifelse(is_mounted("/system"), unmount("/system"));
package_extract_dir("install/bin", "/tmp/install/bin");
set_metadata_recursive("/tmp/install/bin", "uid", 0, "gid", 0, "dmode", 0755, "fmode", 0755);
assert(run_program("/tmp/install/bin/run_scripts.sh", "installbegin") == 0);
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");
unmount("/system");
if is_mounted("/data") then
package_extract_file("META-INF/org/lineageos/releasekey", "/tmp/releasekey");
run_program("/tmp/install/bin/otasigcheck.sh") != "31744" || abort("Can't install this package on top of incompatible data. Please try another package or run a factory reset");
else
mount("ext4", "EMMC", "/dev/block/bootdevice/by-name/userdata", "/data", "");
package_extract_file("META-INF/org/lineageos/releasekey", "/tmp/releasekey");
run_program("/tmp/install/bin/otasigcheck.sh") != "31744" || abort("Can't install this package on top of incompatible data. Please try another package or run a factory reset");
unmount("/data");
endif;
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", "system.patch.dat") ||
  abort("E1001: Failed to update system image.");
assert(run_program("/tmp/install/bin/run_scripts.sh", "postvalidate") == 0);
show_progress(0.020000, 10);
mount("ext4", "EMMC", "/dev/block/bootdevice/by-name/system", "/system", "");
run_program("/tmp/install/bin/backuptool.sh", "restore");
unmount("/system");
show_progress(0.050000, 5);
package_extract_file("boot.img", "/dev/block/bootdevice/by-name/boot");
show_progress(0.200000, 10);
assert(run_program("/tmp/install/bin/run_scripts.sh", "installend") == 0);
set_progress(1.000000);
