mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-04-22 15:01:33 +00:00
Deprecate path /sbin/.core, switch to /sbin/.magisk
Symlink is preserved for backwards compatibility
This commit is contained in:
parent
83ae66daea
commit
376e7977f0
@ -27,7 +27,7 @@ public class Const {
|
|||||||
MAGISK_PATH = MAGISK_DISABLE_FILE = MAGISK_HOST_FILE = new File("xxx");
|
MAGISK_PATH = MAGISK_DISABLE_FILE = MAGISK_HOST_FILE = new File("xxx");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final String BUSYBOX_PATH = "/sbin/.core/busybox";
|
public static final String BUSYBOX_PATH = "/sbin/.magisk/busybox";
|
||||||
public static final String TMP_FOLDER_PATH = "/dev/tmp";
|
public static final String TMP_FOLDER_PATH = "/dev/tmp";
|
||||||
public static final String MAGISK_LOG = "/cache/magisk.log";
|
public static final String MAGISK_LOG = "/cache/magisk.log";
|
||||||
public static final String MANAGER_CONFIGS = ".tmp.magisk.config";
|
public static final String MANAGER_CONFIGS = ".tmp.magisk.config";
|
||||||
|
@ -20,7 +20,7 @@ public class MagiskDB {
|
|||||||
static final String SETTINGS_TABLE = "settings";
|
static final String SETTINGS_TABLE = "settings";
|
||||||
static final String STRINGS_TABLE = "strings";
|
static final String STRINGS_TABLE = "strings";
|
||||||
static final File LEGACY_MANAGER_DB =
|
static final File LEGACY_MANAGER_DB =
|
||||||
new File(Utils.fmt("/sbin/.core/db-%d/magisk.db", Const.USER_ID));
|
new File(Utils.fmt("/sbin/.magisk/db-%d/magisk.db", Const.USER_ID));
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
public static MagiskDB getInstance() {
|
public static MagiskDB getInstance() {
|
||||||
|
@ -29,12 +29,15 @@ public class RootUtils extends Shell.Initializer {
|
|||||||
public boolean onInit(Context context, @NonNull Shell shell) {
|
public boolean onInit(Context context, @NonNull Shell shell) {
|
||||||
Shell.Job job = shell.newJob();
|
Shell.Job job = shell.newJob();
|
||||||
if (shell.isRoot()) {
|
if (shell.isRoot()) {
|
||||||
|
if (!new SuFile("/sbin/.magisk").exists())
|
||||||
|
job.add("ln -s /sbin/.core /sbin/.magisk");
|
||||||
|
|
||||||
InputStream magiskUtils = context.getResources().openRawResource(R.raw.util_functions);
|
InputStream magiskUtils = context.getResources().openRawResource(R.raw.util_functions);
|
||||||
InputStream managerUtils = context.getResources().openRawResource(R.raw.utils);
|
InputStream managerUtils = context.getResources().openRawResource(R.raw.utils);
|
||||||
job.add(magiskUtils).add(managerUtils);
|
job.add(magiskUtils).add(managerUtils);
|
||||||
|
|
||||||
Const.MAGISK_DISABLE_FILE = new SuFile("/cache/.disable_magisk");
|
Const.MAGISK_DISABLE_FILE = new SuFile("/cache/.disable_magisk");
|
||||||
SuFile file = new SuFile("/sbin/.core/img");
|
SuFile file = new SuFile("/sbin/.magisk/img");
|
||||||
if (file.exists()) {
|
if (file.exists()) {
|
||||||
Const.MAGISK_PATH = file;
|
Const.MAGISK_PATH = file;
|
||||||
} else if ((file = new SuFile("/dev/magisk/img")).exists()) {
|
} else if ((file = new SuFile("/dev/magisk/img")).exists()) {
|
||||||
|
@ -6,7 +6,7 @@ db_sepatch() {
|
|||||||
|
|
||||||
db_clean() {
|
db_clean() {
|
||||||
local USERID=$1
|
local USERID=$1
|
||||||
local DIR="/sbin/.core/db-${USERID}"
|
local DIR="/sbin/.magisk/db-${USERID}"
|
||||||
umount -l /data/user*/*/*/databases/su.db $DIR $DIR/*
|
umount -l /data/user*/*/*/databases/su.db $DIR $DIR/*
|
||||||
rm -rf $DIR
|
rm -rf $DIR
|
||||||
[ "$USERID" = "*" ] && rm -fv /data/adb/magisk.db*
|
[ "$USERID" = "*" ] && rm -fv /data/adb/magisk.db*
|
||||||
@ -26,7 +26,7 @@ db_restore() {
|
|||||||
db_setup() {
|
db_setup() {
|
||||||
local USER=$1
|
local USER=$1
|
||||||
local USERID=$(($USER / 100000))
|
local USERID=$(($USER / 100000))
|
||||||
local DIR=/sbin/.core/db-${USERID}
|
local DIR=/sbin/.magisk/db-${USERID}
|
||||||
mkdir -p $DIR
|
mkdir -p $DIR
|
||||||
touch $DIR/magisk.db
|
touch $DIR/magisk.db
|
||||||
mount -o bind /data/adb/magisk.db $DIR/magisk.db
|
mount -o bind /data/adb/magisk.db $DIR/magisk.db
|
||||||
@ -49,8 +49,8 @@ fix_env() {
|
|||||||
sh update-binary extract
|
sh update-binary extract
|
||||||
rm -f update-binary magisk.apk
|
rm -f update-binary magisk.apk
|
||||||
cd /
|
cd /
|
||||||
rm -rf /sbin/.core/busybox/*
|
rm -rf /sbin/.magisk/busybox/*
|
||||||
/sbin/.core/mirror/bin/busybox --install -s /sbin/.core/busybox
|
/sbin/.magisk/mirror/bin/busybox --install -s /sbin/.magisk/busybox
|
||||||
}
|
}
|
||||||
|
|
||||||
direct_install() {
|
direct_install() {
|
||||||
|
@ -417,6 +417,9 @@ static bool magisk_env() {
|
|||||||
unlink("/data/magisk.img");
|
unlink("/data/magisk.img");
|
||||||
unlink("/data/magisk_debug.log");
|
unlink("/data/magisk_debug.log");
|
||||||
|
|
||||||
|
// Symlink for legacy path users
|
||||||
|
symlink(MAGISKTMP, "/sbin/.core");
|
||||||
|
|
||||||
// Create directories in tmpfs overlay
|
// Create directories in tmpfs overlay
|
||||||
xmkdirs(MIRRDIR "/system", 0755);
|
xmkdirs(MIRRDIR "/system", 0755);
|
||||||
xmkdir(MIRRDIR "/bin", 0755);
|
xmkdir(MIRRDIR "/bin", 0755);
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
#define LOGFILE "/cache/magisk.log"
|
#define LOGFILE "/cache/magisk.log"
|
||||||
#define UNBLOCKFILE "/dev/.magisk.unblock"
|
#define UNBLOCKFILE "/dev/.magisk.unblock"
|
||||||
#define DISABLEFILE "/cache/.disable_magisk"
|
#define DISABLEFILE "/cache/.disable_magisk"
|
||||||
#define MAGISKTMP "/sbin/.core"
|
#define MAGISKTMP "/sbin/.magisk"
|
||||||
#define BLOCKDIR MAGISKTMP "/block"
|
#define BLOCKDIR MAGISKTMP "/block"
|
||||||
#define MIRRDIR MAGISKTMP "/mirror"
|
#define MIRRDIR MAGISKTMP "/mirror"
|
||||||
#define BBPATH MAGISKTMP "/busybox"
|
#define BBPATH MAGISKTMP "/busybox"
|
||||||
|
@ -15,10 +15,10 @@ $BOOTMODE || ps | grep zygote | grep -qv grep && BOOTMODE=true
|
|||||||
$BOOTMODE || ps -A | grep zygote | grep -qv grep && BOOTMODE=true
|
$BOOTMODE || ps -A | grep zygote | grep -qv grep && BOOTMODE=true
|
||||||
|
|
||||||
# Presets
|
# Presets
|
||||||
|
MAGISKTMP=/sbin/.magisk
|
||||||
[ -z $NVBASE ] && NVBASE=/data/adb
|
[ -z $NVBASE ] && NVBASE=/data/adb
|
||||||
[ -z $MAGISKBIN ] && MAGISKBIN=$NVBASE/magisk
|
[ -z $MAGISKBIN ] && MAGISKBIN=$NVBASE/magisk
|
||||||
[ -z $IMG ] && IMG=$NVBASE/magisk.img
|
[ -z $IMG ] && IMG=$NVBASE/magisk.img
|
||||||
[ -z $MOUNTPATH ] && MOUNTPATH=/sbin/.core/img
|
|
||||||
|
|
||||||
# Bootsigner related stuff
|
# Bootsigner related stuff
|
||||||
BOOTSIGNERCLASS=a.a
|
BOOTSIGNERCLASS=a.a
|
||||||
@ -306,9 +306,9 @@ check_data() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setup_bb() {
|
setup_bb() {
|
||||||
if [ -x /sbin/.core/busybox/busybox ]; then
|
if [ -x $MAGISKTMP/busybox/busybox ]; then
|
||||||
# Make sure this path is in the front
|
# Make sure this path is in the front
|
||||||
echo $PATH | grep -q '^/sbin/.core/busybox' || export PATH=/sbin/.core/busybox:$PATH
|
echo $PATH | grep -q "^$MAGISKTMP/busybox" || export PATH=$MAGISKTMP/busybox:$PATH
|
||||||
elif [ -x $TMPDIR/bin/busybox ]; then
|
elif [ -x $TMPDIR/bin/busybox ]; then
|
||||||
# Make sure this path is in the front
|
# Make sure this path is in the front
|
||||||
echo $PATH | grep -q "^$TMPDIR/bin" || export PATH=$TMPDIR/bin:$PATH
|
echo $PATH | grep -q "^$TMPDIR/bin" || export PATH=$TMPDIR/bin:$PATH
|
||||||
@ -322,11 +322,11 @@ setup_bb() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
boot_actions() {
|
boot_actions() {
|
||||||
if [ ! -d /sbin/.core/mirror/bin ]; then
|
if [ ! -d $MAGISKTMP/mirror/bin ]; then
|
||||||
mkdir -p /sbin/.core/mirror/bin
|
mkdir -p $MAGISKTMP/mirror/bin
|
||||||
mount -o bind $MAGISKBIN /sbin/.core/mirror/bin
|
mount -o bind $MAGISKBIN $MAGISKTMP/mirror/bin
|
||||||
fi
|
fi
|
||||||
MAGISKBIN=/sbin/.core/mirror/bin
|
MAGISKBIN=$MAGISKTMP/mirror/bin
|
||||||
setup_bb
|
setup_bb
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user