mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-25 02:55:33 +00:00
Rename dir name
This commit is contained in:
parent
92b305a389
commit
10069215f4
@ -14,7 +14,7 @@ env_check() {
|
|||||||
[ -f "$MAGISKBIN/magiskpolicy" ] || return 1
|
[ -f "$MAGISKBIN/magiskpolicy" ] || return 1
|
||||||
fi
|
fi
|
||||||
if [ "$2" -ge 25210 ]; then
|
if [ "$2" -ge 25210 ]; then
|
||||||
[ -b "$MAGISKTMP/.magisk/block/preinit" ] || return 2
|
[ -b "$MAGISKTMP/.magisk/device/preinit" ] || [ -b "$MAGISKTMP/.magisk/block/preinit" ] || return 2
|
||||||
fi
|
fi
|
||||||
grep -xqF "MAGISK_VER='$1'" "$MAGISKBIN/util_functions.sh" || return 3
|
grep -xqF "MAGISK_VER='$1'" "$MAGISKBIN/util_functions.sh" || return 3
|
||||||
grep -xqF "MAGISK_VER_CODE=$2" "$MAGISKBIN/util_functions.sh" || return 3
|
grep -xqF "MAGISK_VER_CODE=$2" "$MAGISKBIN/util_functions.sh" || return 3
|
||||||
|
@ -72,6 +72,7 @@ static void setup_mounts() {
|
|||||||
|
|
||||||
// Prepare worker
|
// Prepare worker
|
||||||
ssprintf(path, sizeof(path), "%s/" WORKERDIR, get_magisk_tmp());
|
ssprintf(path, sizeof(path), "%s/" WORKERDIR, get_magisk_tmp());
|
||||||
|
xmkdir(path, 0);
|
||||||
xmount("worker", path, "tmpfs", 0, "mode=755");
|
xmount("worker", path, "tmpfs", 0, "mode=755");
|
||||||
xmount(nullptr, path, nullptr, MS_PRIVATE, nullptr);
|
xmount(nullptr, path, nullptr, MS_PRIVATE, nullptr);
|
||||||
}
|
}
|
||||||
|
@ -13,8 +13,8 @@
|
|||||||
#define INTLROOT ".magisk"
|
#define INTLROOT ".magisk"
|
||||||
#define MIRRDIR INTLROOT "/mirror"
|
#define MIRRDIR INTLROOT "/mirror"
|
||||||
#define PREINITMIRR INTLROOT "/preinit"
|
#define PREINITMIRR INTLROOT "/preinit"
|
||||||
#define BLOCKDIR INTLROOT "/block"
|
#define DEVICEDIR INTLROOT "/device"
|
||||||
#define PREINITDEV BLOCKDIR "/preinit"
|
#define PREINITDEV DEVICEDIR "/preinit"
|
||||||
#define WORKERDIR INTLROOT "/worker"
|
#define WORKERDIR INTLROOT "/worker"
|
||||||
#define MODULEMNT INTLROOT "/modules"
|
#define MODULEMNT INTLROOT "/modules"
|
||||||
#define BBPATH INTLROOT "/busybox"
|
#define BBPATH INTLROOT "/busybox"
|
||||||
@ -23,8 +23,8 @@
|
|||||||
#define ROOTMNT ROOTOVL "/.mount_list"
|
#define ROOTMNT ROOTOVL "/.mount_list"
|
||||||
#define SELINUXMOCK INTLROOT "/selinux"
|
#define SELINUXMOCK INTLROOT "/selinux"
|
||||||
#define MAIN_CONFIG INTLROOT "/config"
|
#define MAIN_CONFIG INTLROOT "/config"
|
||||||
#define MAIN_SOCKET INTLROOT "/socket"
|
#define MAIN_SOCKET DEVICEDIR "/socket"
|
||||||
#define LOG_PIPE INTLROOT "/log"
|
#define LOG_PIPE DEVICEDIR "/log"
|
||||||
|
|
||||||
constexpr const char *applet_names[] = { "su", "resetprop", nullptr };
|
constexpr const char *applet_names[] = { "su", "resetprop", nullptr };
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ macro_rules! INTLROOT {
|
|||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! LOG_PIPE {
|
macro_rules! LOG_PIPE {
|
||||||
() => {
|
() => {
|
||||||
concat!($crate::INTLROOT!(), "/log")
|
concat!($crate::INTLROOT!(), "/device/log")
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,8 +100,6 @@ static dev_t setup_block() {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define PREINITMNT MIRRDIR "/preinit"
|
|
||||||
|
|
||||||
static void mount_preinit_dir(string preinit_dev) {
|
static void mount_preinit_dir(string preinit_dev) {
|
||||||
if (preinit_dev.empty()) return;
|
if (preinit_dev.empty()) return;
|
||||||
strcpy(blk_info.partname, preinit_dev.data());
|
strcpy(blk_info.partname, preinit_dev.data());
|
||||||
@ -111,13 +109,13 @@ static void mount_preinit_dir(string preinit_dev) {
|
|||||||
LOGE("Cannot find preinit %s, abort!\n", preinit_dev.data());
|
LOGE("Cannot find preinit %s, abort!\n", preinit_dev.data());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
xmkdir(PREINITMNT, 0);
|
xmkdir(MIRRDIR, 0);
|
||||||
bool mounted = false;
|
bool mounted = false;
|
||||||
// First, find if it is already mounted
|
// First, find if it is already mounted
|
||||||
std::string mnt_point;
|
std::string mnt_point;
|
||||||
if (rust::is_device_mounted(dev, mnt_point)) {
|
if (rust::is_device_mounted(dev, mnt_point)) {
|
||||||
// Already mounted, just bind mount
|
// Already mounted, just bind mount
|
||||||
xmount(mnt_point.data(), PREINITMNT, nullptr, MS_BIND, nullptr);
|
xmount(mnt_point.data(), MIRRDIR, nullptr, MS_BIND, nullptr);
|
||||||
mounted = true;
|
mounted = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -125,9 +123,9 @@ static void mount_preinit_dir(string preinit_dev) {
|
|||||||
// as read-only, or else the kernel might crash due to crappy drivers.
|
// as read-only, or else the kernel might crash due to crappy drivers.
|
||||||
// After the device boots up, magiskd will properly bind mount the correct partition
|
// After the device boots up, magiskd will properly bind mount the correct partition
|
||||||
// on to PREINITMIRR as writable. For more details, check bootstages.cpp
|
// on to PREINITMIRR as writable. For more details, check bootstages.cpp
|
||||||
if (mounted || mount(PREINITDEV, PREINITMNT, "ext4", MS_RDONLY, nullptr) == 0 ||
|
if (mounted || mount(PREINITDEV, MIRRDIR, "ext4", MS_RDONLY, nullptr) == 0 ||
|
||||||
mount(PREINITDEV, PREINITMNT, "f2fs", MS_RDONLY, nullptr) == 0) {
|
mount(PREINITDEV, MIRRDIR, "f2fs", MS_RDONLY, nullptr) == 0) {
|
||||||
string preinit_dir = resolve_preinit_dir(PREINITMNT);
|
string preinit_dir = resolve_preinit_dir(MIRRDIR);
|
||||||
// Create bind mount
|
// Create bind mount
|
||||||
xmkdirs(PREINITMIRR, 0);
|
xmkdirs(PREINITMIRR, 0);
|
||||||
if (access(preinit_dir.data(), F_OK)) {
|
if (access(preinit_dir.data(), F_OK)) {
|
||||||
@ -136,7 +134,7 @@ static void mount_preinit_dir(string preinit_dev) {
|
|||||||
LOGD("preinit: %s\n", preinit_dir.data());
|
LOGD("preinit: %s\n", preinit_dir.data());
|
||||||
xmount(preinit_dir.data(), PREINITMIRR, nullptr, MS_BIND, nullptr);
|
xmount(preinit_dir.data(), PREINITMIRR, nullptr, MS_BIND, nullptr);
|
||||||
}
|
}
|
||||||
xumount2(PREINITMNT, MNT_DETACH);
|
xumount2(MIRRDIR, MNT_DETACH);
|
||||||
} else {
|
} else {
|
||||||
PLOGE("Failed to mount preinit %s\n", preinit_dev.data());
|
PLOGE("Failed to mount preinit %s\n", preinit_dev.data());
|
||||||
unlink(PREINITDEV);
|
unlink(PREINITDEV);
|
||||||
@ -237,9 +235,7 @@ void MagiskInit::setup_tmp(const char *path) {
|
|||||||
chdir("/data");
|
chdir("/data");
|
||||||
|
|
||||||
xmkdir(INTLROOT, 0711);
|
xmkdir(INTLROOT, 0711);
|
||||||
xmkdir(MIRRDIR, 0);
|
xmkdir(DEVICEDIR, 0711);
|
||||||
xmkdir(BLOCKDIR, 0);
|
|
||||||
xmkdir(WORKERDIR, 0);
|
|
||||||
|
|
||||||
mount_preinit_dir(preinit_dev);
|
mount_preinit_dir(preinit_dev);
|
||||||
|
|
||||||
|
@ -13,7 +13,6 @@ using namespace std;
|
|||||||
|
|
||||||
static vector<string> rc_list;
|
static vector<string> rc_list;
|
||||||
|
|
||||||
#define ROOTMIR MIRRDIR "/system_root"
|
|
||||||
#define NEW_INITRC_DIR "/system/etc/init/hw"
|
#define NEW_INITRC_DIR "/system/etc/init/hw"
|
||||||
#define INIT_RC "init.rc"
|
#define INIT_RC "init.rc"
|
||||||
|
|
||||||
@ -250,10 +249,10 @@ void MagiskInit::patch_ro_root() {
|
|||||||
|
|
||||||
if (tmp_dir == "/sbin") {
|
if (tmp_dir == "/sbin") {
|
||||||
// Recreate original sbin structure
|
// Recreate original sbin structure
|
||||||
xmkdir(ROOTMIR, 0755);
|
xmkdir(MIRRDIR, 0755);
|
||||||
xmount("/", ROOTMIR, nullptr, MS_BIND, nullptr);
|
xmount("/", MIRRDIR, nullptr, MS_BIND, nullptr);
|
||||||
recreate_sbin(ROOTMIR "/sbin", true);
|
recreate_sbin(MIRRDIR "/sbin", true);
|
||||||
xumount2(ROOTMIR, MNT_DETACH);
|
xumount2(MIRRDIR, MNT_DETACH);
|
||||||
} else {
|
} else {
|
||||||
// Restore debug_ramdisk
|
// Restore debug_ramdisk
|
||||||
xmount("/data/debug_ramdisk", "/debug_ramdisk", nullptr, MS_MOVE, nullptr);
|
xmount("/data/debug_ramdisk", "/debug_ramdisk", nullptr, MS_MOVE, nullptr);
|
||||||
|
@ -138,9 +138,7 @@ ln -s ./magisk $MAGISKTMP/su
|
|||||||
ln -s ./magisk $MAGISKTMP/resetprop
|
ln -s ./magisk $MAGISKTMP/resetprop
|
||||||
ln -s ./magiskpolicy $MAGISKTMP/supolicy
|
ln -s ./magiskpolicy $MAGISKTMP/supolicy
|
||||||
|
|
||||||
mkdir -p $MAGISKTMP/.magisk/mirror
|
mkdir -p $MAGISKTMP/.magisk/device
|
||||||
mkdir $MAGISKTMP/.magisk/block
|
|
||||||
mkdir $MAGISKTMP/.magisk/worker
|
|
||||||
touch $MAGISKTMP/.magisk/config
|
touch $MAGISKTMP/.magisk/config
|
||||||
|
|
||||||
export MAGISKTMP
|
export MAGISKTMP
|
||||||
|
Loading…
Reference in New Issue
Block a user