mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-27 20:15:29 +00:00
Allow modules to have custom uninstaller script
This commit is contained in:
parent
8df942f96e
commit
8de03eef3f
@ -482,6 +482,9 @@ static void collect_modules() {
|
|||||||
if (access("remove", F_OK) == 0) {
|
if (access("remove", F_OK) == 0) {
|
||||||
chdir("..");
|
chdir("..");
|
||||||
LOGI("%s: remove\n", entry->d_name);
|
LOGI("%s: remove\n", entry->d_name);
|
||||||
|
sprintf(buf, "%s/uninstall.sh", entry->d_name);
|
||||||
|
if (access(buf, F_OK) == 0)
|
||||||
|
exec_script(buf);
|
||||||
rm_rf(entry->d_name);
|
rm_rf(entry->d_name);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,14 @@ static void set_path() {
|
|||||||
setenv("PATH", buf, 1);
|
setenv("PATH", buf, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void exec_script(const char *script) {
|
||||||
|
exec_t exec {
|
||||||
|
.pre_exec = set_path,
|
||||||
|
.fork = fork_no_zombie
|
||||||
|
};
|
||||||
|
exec_command_sync(exec, "/system/bin/sh", script);
|
||||||
|
}
|
||||||
|
|
||||||
void exec_common_script(const char *stage) {
|
void exec_common_script(const char *stage) {
|
||||||
char path[4096];
|
char path[4096];
|
||||||
DIR *dir;
|
DIR *dir;
|
||||||
|
@ -69,6 +69,7 @@ void boot_complete(int client);
|
|||||||
* Scripting *
|
* Scripting *
|
||||||
*************/
|
*************/
|
||||||
|
|
||||||
|
void exec_script(const char *script);
|
||||||
void exec_common_script(const char *stage);
|
void exec_common_script(const char *stage);
|
||||||
void exec_module_script(const char *stage, const std::vector<std::string> &module_list);
|
void exec_module_script(const char *stage, const std::vector<std::string> &module_list);
|
||||||
void migrate_img(const char *img);
|
void migrate_img(const char *img);
|
||||||
|
Loading…
Reference in New Issue
Block a user