aboutsummaryrefslogtreecommitdiffstats
path: root/addonsu/updater-script-install
diff options
context:
space:
mode:
Diffstat (limited to 'addonsu/updater-script-install')
-rw-r--r--addonsu/updater-script-install21
1 files changed, 21 insertions, 0 deletions
diff --git a/addonsu/updater-script-install b/addonsu/updater-script-install
new file mode 100644
index 00000000..762ddc5b
--- /dev/null
+++ b/addonsu/updater-script-install
@@ -0,0 +1,21 @@
+ui_print("Installing su addon...");
+ifelse(is_mounted("/system"), unmount("/system"));
+package_extract_file("mount-system.sh", "/tmp/mount-system.sh");
+set_metadata("/tmp/mount-system.sh", "uid", 0, "gid", 0, "mode", 0755);
+run_program("/tmp/mount-system.sh") == 0 || abort("Could not mount /system");
+
+if getprop("ro.build.system_root_image") != "true" then
+ package_extract_dir("system", "/system");
+ set_metadata("/system/addon.d/51-addonsu.sh", "uid", 0, "gid", 0, "mode", 0755, "selabel", "u:object_r:system_file:s0");
+ set_metadata("/system/xbin/su", "uid", 0, "gid", 2000, "mode", 0755, "selabel", "u:object_r:su_exec:s0");
+ symlink("/system/xbin/su", "/system/bin/su");
+else
+ package_extract_dir("system", "/system/system");
+ set_metadata("/system/system/addon.d/51-addonsu.sh", "uid", 0, "gid", 0, "mode", 0755, "selabel", "u:object_r:system_file:s0");
+ set_metadata("/system/system/xbin/su", "uid", 0, "gid", 2000, "mode", 0755, "selabel", "u:object_r:su_exec:s0");
+ symlink("/system/xbin/su", "/system/system/bin/su");
+endif;
+
+unmount("/system");
+ui_print("Done");
+set_progress(1.000000);