- 19 Apr 2014
- 3,557
- 332
Hello together,
perhaps somebody can help me. I have written a script for twrp.
The script should remove "/system/priv-apps/MiuiCamera/MiuiCamera.apk" and put some new files into the folder.
If I execute the script, it will not delete "/system/priv-apps/MiuiCamera/MiuiCamera.apk" but if I execute it again without reboot, the file is deleted.
I have tried everything ... I think it has to to with the "mount". My TWRP ist mounting "system_root" instead of "system" ...
Perhaps anybody has an idea ....
The updater-script with a lot of tries ...
###########################################################
ui_print(" Set busybox up and running ");
package_extract_file("META-INF/com/miui/busybox", "/tmp/busybox");
run_program("/sbin/chmod", "777", "/tmp/busybox");
###########################################################
# ui_print(" UnMounting filesystem");
# run_program("/tmp/busybox", "umount", "/system");
# unmount("/system");
# run_program("/tmp/busybox", "umount", "/vendor");
# sleep(1);
# ui_print(" Mounting filesystem");
#
# mount("ext4", "EMMC", "system_root", "/system_root");
# mount("ext4", "EMMC", "/dev/block/sde54", "/system");
# mount("yaffs2", "MTD", "system", "/system");
# run_program("/tmp/busybox", "mount", "/system_root");
# run_program("/tmp/busybox", "mount", "/vendor");
sleep(3);
###########################################################
delete_recursive("/system_root/system/priv-app/MiuiCamera");
###########################################################
ui_print(" Delete old files");
package_extract_file("delete.sh", "/tmp/delete.sh");
set_perm(0, 0, 0777, "/tmp/delete.sh");
run_program("/tmp/delete.sh", "");
delete("/tmp/delete.sh");
###########################################################
run_program("/tmp/busybox", "rm", "-f", "/system_root/system/priv-app/MiuiCamera/*");
delete("/system_root/system/priv-app/MiuiCamera/MiuiCamera*");
delete("/system_root/system/priv-app/MiuiCamera/MiuiCamera.apk");
sleep(1);
###########################################################
ui_print(" Extracting system filesystem");
package_extract_dir("system", "/system");
ui_print(" Extracting vendor filesystem");
package_extract_dir("vendor", "/vendor");
sleep(1);
###########################################################
# ui_print(" Set permission on vendor");
# set_perm_recursive(0,2000,0755, 0755, "/vendor/camera");
ui_print(" UnMounting filesystem");
# run_program("/tmp/busybox", "umount", "/system");
# unmount("/system");
# run_program("/tmp/busybox", "umount", "/vendor");
ui_print(" Done.... Ready to reboot");
ui_print("-------------------------------------");
ui_print(" ");
The delete-script:
#!/sbin/sh
rm -f /system_root/system/priv-app/MiuiCamera/MiuiCamera.apk
# cat /proc/mounts > /tmp/test.txt
Kind regards Kater
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Solution:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
But I want to keep the script as simple as possible, so I have decided do go back to the roots -> shell scripting
And now it is working no matter if "/system" or "/system_root" is listed in the fstab
With this scripts I don't want to win a programming contest, it is simple, works and good
TWRP_Flashable_Zip_Example.zip
drive.google.com
This is the magic (mount.sh) and double delete:
mount -o rw,remount /system
mount -o rw,remount /system /system
mount -o rw,remount /system_root
mount -o rw,remount /system_root /system_root
rm -f /system_root/system/priv-app/MiuiCamera/MiuiCamera.apk
rm -f /system/priv-app/MiuiCamera/MiuiCamera.apk
Now MimojiCamera is working with one install-step in twrp, for those guys who want to have it.
https://xiaomi.eu/community/threads/how-to-install-mimoji-camera-into-xiaomi-eu-rom.54976/
perhaps somebody can help me. I have written a script for twrp.
The script should remove "/system/priv-apps/MiuiCamera/MiuiCamera.apk" and put some new files into the folder.
If I execute the script, it will not delete "/system/priv-apps/MiuiCamera/MiuiCamera.apk" but if I execute it again without reboot, the file is deleted.
I have tried everything ... I think it has to to with the "mount". My TWRP ist mounting "system_root" instead of "system" ...
Perhaps anybody has an idea ....
The updater-script with a lot of tries ...
###########################################################
ui_print(" Set busybox up and running ");
package_extract_file("META-INF/com/miui/busybox", "/tmp/busybox");
run_program("/sbin/chmod", "777", "/tmp/busybox");
###########################################################
# ui_print(" UnMounting filesystem");
# run_program("/tmp/busybox", "umount", "/system");
# unmount("/system");
# run_program("/tmp/busybox", "umount", "/vendor");
# sleep(1);
# ui_print(" Mounting filesystem");
#
# mount("ext4", "EMMC", "system_root", "/system_root");
# mount("ext4", "EMMC", "/dev/block/sde54", "/system");
# mount("yaffs2", "MTD", "system", "/system");
# run_program("/tmp/busybox", "mount", "/system_root");
# run_program("/tmp/busybox", "mount", "/vendor");
sleep(3);
###########################################################
delete_recursive("/system_root/system/priv-app/MiuiCamera");
###########################################################
ui_print(" Delete old files");
package_extract_file("delete.sh", "/tmp/delete.sh");
set_perm(0, 0, 0777, "/tmp/delete.sh");
run_program("/tmp/delete.sh", "");
delete("/tmp/delete.sh");
###########################################################
run_program("/tmp/busybox", "rm", "-f", "/system_root/system/priv-app/MiuiCamera/*");
delete("/system_root/system/priv-app/MiuiCamera/MiuiCamera*");
delete("/system_root/system/priv-app/MiuiCamera/MiuiCamera.apk");
sleep(1);
###########################################################
ui_print(" Extracting system filesystem");
package_extract_dir("system", "/system");
ui_print(" Extracting vendor filesystem");
package_extract_dir("vendor", "/vendor");
sleep(1);
###########################################################
# ui_print(" Set permission on vendor");
# set_perm_recursive(0,2000,0755, 0755, "/vendor/camera");
ui_print(" UnMounting filesystem");
# run_program("/tmp/busybox", "umount", "/system");
# unmount("/system");
# run_program("/tmp/busybox", "umount", "/vendor");
ui_print(" Done.... Ready to reboot");
ui_print("-------------------------------------");
ui_print(" ");
The delete-script:
#!/sbin/sh
rm -f /system_root/system/priv-app/MiuiCamera/MiuiCamera.apk
# cat /proc/mounts > /tmp/test.txt
Kind regards Kater
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Solution:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
But I want to keep the script as simple as possible, so I have decided do go back to the roots -> shell scripting
And now it is working no matter if "/system" or "/system_root" is listed in the fstab
With this scripts I don't want to win a programming contest, it is simple, works and good
TWRP_Flashable_Zip_Example.zip
This is the magic (mount.sh) and double delete:
mount -o rw,remount /system
mount -o rw,remount /system /system
mount -o rw,remount /system_root
mount -o rw,remount /system_root /system_root
rm -f /system_root/system/priv-app/MiuiCamera/MiuiCamera.apk
rm -f /system/priv-app/MiuiCamera/MiuiCamera.apk
Now MimojiCamera is working with one install-step in twrp, for those guys who want to have it.
https://xiaomi.eu/community/threads/how-to-install-mimoji-camera-into-xiaomi-eu-rom.54976/
Last edited: