Skip to content

Instantly share code, notes, and snippets.

@taaem
Created March 26, 2016 16:14
Show Gist options
  • Save taaem/8ffe56816b300755d848 to your computer and use it in GitHub Desktop.
Save taaem/8ffe56816b300755d848 to your computer and use it in GitHub Desktop.
Updater Script
ui_print("");
ui_print("========================================");
ui_print("Hybris Installer");
ui_print("========================================");
ui_print(" Device: onyx");
ui_print(" Version: 2.0.0.10");
ui_print(" Image: sailfishos-onyx-release-2.0.0.10-alpha-1.tar.bz2");
ui_print(" Size: 303M");
ui_print(" Partitions:");
ui_print(" /boot -> /dev/block/platform/msm_sdcc.1/by-name/boot");
ui_print(" /data -> /dev/block/platform/msm_sdcc.1/by-name/userdata");
ui_print("========================================");
ui_print("");
assert(getprop("ro.product.device") == "onyx" || getprop("ro.build.product") == "onyx" || getprop("ro.cm.device") == "onyx" || getprop("ro.product.device") == "ONE" || getprop("ro.build.product") == "ONE" || getprop("ro.cm.device") == "ONE");
ui_print("Device check succeeded, mounting filesystems ...");
mount("ext4", "EMMC", "/dev/block/platform/msm_sdcc.1/by-name/userdata", "/data");
ui_print("Copying filesystem archive ...");
package_extract_file("sailfishos-onyx-release-2.0.0.10-alpha-1.tar.bz2", "/data/sailfishos-rootfs.tar.bz2");
ui_print("Copying installation script ...");
package_extract_file("updater-unpack.sh", "/tmp/updater-unpack.sh");
ui_print("Running installation script ...");
set_metadata("/tmp/updater-unpack.sh", "uid", 0, "gid", 0, "mode", 0755);
run_program("/tmp/updater-unpack.sh") == "0" || abort("Failed to extract filesystem!");
ui_print("Flashing hybris-boot.img ...");
package_extract_file("hybris-boot.img", "/dev/block/platform/msm_sdcc.1/by-name/boot");
ui_print("Unmounting filesystems ...");
unmount("/data");
ui_print("Done!");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment