blob: c807739f221617827b4231307fe057b19b62b3f0 [file] [log] [blame]
Gabriele M5b33c6c2017-01-22 22:50:02 +01001ui_print("Installing su addon...");
2ifelse(is_mounted("/system"), unmount("/system"));
3package_extract_file("mount-system.sh", "/tmp/mount-system.sh");
Christopher N. Hesse1f94c932018-06-11 21:56:24 +02004package_extract_file("unmount-system.sh", "/tmp/unmount-system.sh");
Gabriele M5b33c6c2017-01-22 22:50:02 +01005set_metadata("/tmp/mount-system.sh", "uid", 0, "gid", 0, "mode", 0755);
Christopher N. Hesse1f94c932018-06-11 21:56:24 +02006set_metadata("/tmp/unmount-system.sh", "uid", 0, "gid", 0, "mode", 0755);
Gabriele M5b33c6c2017-01-22 22:50:02 +01007run_program("/tmp/mount-system.sh") == 0 || abort("Could not mount /system");
8
Christopher N. Hesse1f94c932018-06-11 21:56:24 +02009package_extract_dir("system", "/system");
10set_metadata("/system/addon.d/51-addonsu.sh", "uid", 0, "gid", 0, "mode", 0755, "selabel", "u:object_r:system_file:s0");
11set_metadata("/system/etc/init/superuser.rc", "uid", 0, "gid", 0, "mode", 0644, "selabel", "u:object_r:system_file:s0");
12set_metadata("/system/xbin/su", "uid", 0, "gid", 2000, "mode", 0755, "selabel", "u:object_r:su_exec:s0");
13symlink("/system/xbin/su", "/system/bin/su");
Gabriele M5b33c6c2017-01-22 22:50:02 +010014
Christopher N. Hesse1f94c932018-06-11 21:56:24 +020015run_program("/tmp/unmount-system.sh") == 0 || ui_print("Could not unmount /system");
Gabriele M5b33c6c2017-01-22 22:50:02 +010016ui_print("Done");
17set_progress(1.000000);