Use relative symbolic links

This commit is contained in:
topjohnwu 2019-07-04 17:58:38 -07:00
parent 8e348a11c2
commit 7233285437
2 changed files with 7 additions and 7 deletions

View File

@ -348,8 +348,8 @@ static bool magisk_env() {
unlink("/data/magisk_debug.log");
// Backwards compatibility
symlink(MAGISKTMP, "/sbin/.core");
symlink(MODULEMNT, MAGISKTMP "/img");
symlink("./magisk", "/sbin/.core");
symlink("./modules", MAGISKTMP "/img");
// Directories in tmpfs overlay
xmkdir(MIRRDIR, 0);
@ -663,14 +663,14 @@ void post_fs_data(int client) {
if (access(buf, F_OK) == 0) {
snprintf(buf2, PATH_MAX, "%s/%s/vendor", MODULEROOT, module);
unlink(buf2);
xsymlink(buf, buf2);
xsymlink("./system/vendor", buf2);
}
// If /system/product exists in module, create a link outside
snprintf(buf, PATH_MAX, "%s/%s/system/product", MODULEROOT, module);
if (access(buf, F_OK) == 0) {
snprintf(buf2, PATH_MAX, "%s/%s/product", MODULEROOT, module);
unlink(buf2);
xsymlink(buf, buf2);
xsymlink("./system/product", buf2);
}
sys_root->create_module_tree(module);
}

View File

@ -185,10 +185,10 @@ static void sbin_overlay(const raw_data &self, const raw_data &config) {
char path[64];
for (int i = 0; applet_names[i]; ++i) {
sprintf(path, "/sbin/%s", applet_names[i]);
xsymlink("/sbin/magisk", path);
xsymlink("./magisk", path);
}
xsymlink("/sbin/magiskinit", "/sbin/magiskpolicy");
xsymlink("/sbin/magiskinit", "/sbin/supolicy");
xsymlink("./magiskinit", "/sbin/magiskpolicy");
xsymlink("./magiskinit", "/sbin/supolicy");
}
#define ROOTMIR MIRRDIR "/system_root"