Deleting files with wildcard in updater-script

3k Views Asked by At

I can use delete of updater-script to delete a file in /system:

delete("/system/app/YouTube.apk");

However, I can't do the following

delete("/system/app/*.odex");

Why doesn't it work?

1

There are 1 best solutions below

1
On

I think the commands are limited..and you only can delete a file if you specify its full name and path. However you can write a sh script to do that thing, and execute it from updater-script.

For example create a sh file with the following code and place it in root of your zip:

#!/sbin/sh

rm -rf /system/app/*.odex

And execute it from updater-script

package_extract_file("rmodex.sh", "/tmp/rmodex.sh");
set_perm(0, 0, 0777, "/tmp/rmodex.sh");
run_program("/tmp/rmodex.sh", "");
delete("/tmp/rmodex.sh");

Where rmodex.sh is the file which you made. And one more thing, be careful because rm -rf /system/app/*.odex will also remove all folders with *.odex name.