show_progress(0.500000, 3);
set_bootloader_env("upgrade_step", "3");

show_progress(0.020000, 0);

ui_print("Wiping System");
format("ubifs", "UBI", "system", "0", "/system");
mount("ubifs", "UBI", "system", "/system");
ui_print("Writing system files");
package_extract_file("KERNEL", "/system/KERNEL");
package_extract_dir("system", "/system");
unmount("/system");

show_progress(0.300000, 60);

ui_print("Writing recovery");
write_raw_image(package_extract_file("recovery.img"), "recovery");

show_progress(0.018000, 0);

ui_print("Writing bootloader");
write_raw_image(package_extract_file("bootloader.img"), "bootloader");

ui_print("Writing logo");
write_raw_image(package_extract_file("logo.img"), "logo");

set_bootloader_env("upgrade_step", "1");
show_progress(0.100000, 0);
ui_print("LibreELEC Installed Successfully");
