Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
Magisk
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Magisk
Commits
376e7977
Commit
376e7977
authored
Nov 15, 2018
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Deprecate path /sbin/.core, switch to /sbin/.magisk
Symlink is preserved for backwards compatibility
parent
83ae66da
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
21 additions
and
15 deletions
+21
-15
Const.java
app/src/full/java/com/topjohnwu/magisk/Const.java
+1
-1
MagiskDB.java
...src/full/java/com/topjohnwu/magisk/database/MagiskDB.java
+1
-1
RootUtils.java
app/src/full/java/com/topjohnwu/magisk/utils/RootUtils.java
+4
-1
utils.sh
app/src/full/res/raw/utils.sh
+4
-4
bootstages.cpp
native/jni/daemon/bootstages.cpp
+3
-0
magisk.h
native/jni/include/magisk.h
+1
-1
util_functions.sh
scripts/util_functions.sh
+7
-7
No files found.
app/src/full/java/com/topjohnwu/magisk/Const.java
View file @
376e7977
...
@@ -27,7 +27,7 @@ public class Const {
...
@@ -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"
;
...
...
app/src/full/java/com/topjohnwu/magisk/database/MagiskDB.java
View file @
376e7977
...
@@ -20,7 +20,7 @@ public class MagiskDB {
...
@@ -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
()
{
...
...
app/src/full/java/com/topjohnwu/magisk/utils/RootUtils.java
View file @
376e7977
...
@@ -29,12 +29,15 @@ public class RootUtils extends Shell.Initializer {
...
@@ -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
())
{
...
...
app/src/full/res/raw/utils.sh
View file @
376e7977
...
@@ -6,7 +6,7 @@ db_sepatch() {
...
@@ -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() {
...
@@ -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() {
...
@@ -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
()
{
...
...
native/jni/daemon/bootstages.cpp
View file @
376e7977
...
@@ -417,6 +417,9 @@ static bool magisk_env() {
...
@@ -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
);
...
...
native/jni/include/magisk.h
View file @
376e7977
...
@@ -12,7 +12,7 @@
...
@@ -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"
...
...
scripts/util_functions.sh
View file @
376e7977
...
@@ -15,10 +15,10 @@ $BOOTMODE || ps | grep zygote | grep -qv grep && BOOTMODE=true
...
@@ -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() {
...
@@ -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() {
...
@@ -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
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment