blob: 60c167e4c1185ad95dd6700a38d2d135b2711257 [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");
4set_metadata("/tmp/mount-system.sh", "uid", 0, "gid", 0, "mode", 0755);
5run_program("/tmp/mount-system.sh") == 0 || abort("Could not mount /system");
6
7if getprop("ro.build.system_root_image") != "true" then
8 package_extract_dir("system", "/system");
9 set_metadata("/system/addon.d/51-addonsu.sh", "uid", 0, "gid", 0, "mode", 0755, "selabel", "u:object_r:system_file:s0");
10 set_metadata("/system/etc/init/superuser.rc", "uid", 0, "gid", 0, "mode", 0644, "selabel", "u:object_r:system_file:s0");
11 set_metadata("/system/xbin/su", "uid", 0, "gid", 2000, "mode", 0755, "selabel", "u:object_r:su_exec:s0");
12 symlink("/system/xbin/su", "/system/bin/su");
13else
14 package_extract_dir("system", "/system/system");
15 set_metadata("/system/system/addon.d/51-addonsu.sh", "uid", 0, "gid", 0, "mode", 0755, "selabel", "u:object_r:system_file:s0");
16 set_metadata("/system/system/etc/init/superuser.rc", "uid", 0, "gid", 0, "mode", 0644, "selabel", "u:object_r:system_file:s0");
17 set_metadata("/system/system/xbin/su", "uid", 0, "gid", 2000, "mode", 0755, "selabel", "u:object_r:su_exec:s0");
18 symlink("/system/xbin/su", "/system/system/bin/su");
19endif;
20
21unmount("/system");
22ui_print("Done");
23set_progress(1.000000);