blob: bd753a352125163a9fb405d81b263a979025618c [file] [log] [blame]
Gabriele M5b33c6c2017-01-22 22:50:02 +01001ui_print("Removing 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
LuK1337fd798c52018-07-05 13:40:09 +02009if getprop("ro.build.system_root_image") != "true" then
10 delete("/system/addon.d/51-addonsu.sh");
11 delete("/system/bin/su");
12 delete("/system/etc/init/superuser.rc");
13 delete("/system/xbin/su");
14else
15 delete("/system/system/addon.d/51-addonsu.sh");
16 delete("/system/system/bin/su");
17 delete("/system/system/etc/init/superuser.rc");
18 delete("/system/system/xbin/su");
19endif;
Gabriele M5b33c6c2017-01-22 22:50:02 +010020
Christopher N. Hesse1f94c932018-06-11 21:56:24 +020021run_program("/tmp/unmount-system.sh") == 0 || ui_print("Could not unmount /system");
Gabriele M5b33c6c2017-01-22 22:50:02 +010022ui_print("Done");
23set_progress(1.000000);