Cleanup legacy code
This commit is contained in:
parent
695c8bc5d0
commit
7668e45890
@ -413,11 +413,6 @@ static bool magisk_env() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void prepare_modules() {
|
static void prepare_modules() {
|
||||||
const char *legacy_imgs[] = {SECURE_DIR "/magisk.img", SECURE_DIR "/magisk_merge.img"};
|
|
||||||
for (auto img : legacy_imgs) {
|
|
||||||
if (access(img, F_OK) == 0)
|
|
||||||
migrate_img(img);
|
|
||||||
}
|
|
||||||
DIR *dir;
|
DIR *dir;
|
||||||
struct dirent *entry;
|
struct dirent *entry;
|
||||||
if ((dir = opendir(MODULEUPGRADE))) {
|
if ((dir = opendir(MODULEUPGRADE))) {
|
||||||
|
@ -72,33 +72,6 @@ void exec_module_script(const char *stage, const vector<string> &module_list) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr char migrate_script[] =
|
|
||||||
"MODULEROOT=" MODULEROOT R"EOF(
|
|
||||||
IMG=%s
|
|
||||||
MNT=/dev/img_mnt
|
|
||||||
e2fsck -yf $IMG
|
|
||||||
mkdir -p $MNT
|
|
||||||
for num in 0 1 2 3 4 5 6 7; do
|
|
||||||
losetup /dev/block/loop${num} $IMG || continue
|
|
||||||
mount -t ext4 /dev/block/loop${num} $MNT
|
|
||||||
rm -rf $MNT/lost+found $MNT/.core
|
|
||||||
magisk --clone $MNT $MODULEROOT
|
|
||||||
umount $MNT
|
|
||||||
rm -rf $MNT
|
|
||||||
losetup -d /dev/block/loop${num}
|
|
||||||
break
|
|
||||||
done
|
|
||||||
rm -rf $IMG
|
|
||||||
)EOF";
|
|
||||||
|
|
||||||
void migrate_img(const char *img) {
|
|
||||||
LOGI("* Migrating %s\n", img);
|
|
||||||
exec_t exec { .pre_exec = set_path };
|
|
||||||
char cmds[sizeof(migrate_script) + 128];
|
|
||||||
sprintf(cmds, migrate_script, img);
|
|
||||||
exec_command_sync(exec, "/system/bin/sh", "-c", cmds);
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr char install_script[] = R"EOF(
|
constexpr char install_script[] = R"EOF(
|
||||||
APK=%s
|
APK=%s
|
||||||
log -t Magisk "apk_install: $APK"
|
log -t Magisk "apk_install: $APK"
|
||||||
|
@ -68,7 +68,6 @@ void remove_modules();
|
|||||||
void exec_script(const char *script);
|
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 install_apk(const char *apk);
|
void install_apk(const char *apk);
|
||||||
|
|
||||||
/**************
|
/**************
|
||||||
|
Loading…
Reference in New Issue
Block a user