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
b4cfe6e9
Commit
b4cfe6e9
authored
Jan 02, 2017
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Proper vendor support
parent
94a861e3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
7 deletions
+31
-7
hide.c
jni/magiskhide/hide.c
+1
-1
magic_mask.sh
scripts/magic_mask.sh
+30
-6
No files found.
jni/magiskhide/hide.c
View file @
b4cfe6e9
...
@@ -42,7 +42,7 @@ int hideMagisk() {
...
@@ -42,7 +42,7 @@ int hideMagisk() {
// First unmount the dummy skeletons and the cache mounts
// First unmount the dummy skeletons and the cache mounts
for
(
i
=
mount_size
-
1
;
i
>=
0
;
--
i
)
{
for
(
i
=
mount_size
-
1
;
i
>=
0
;
--
i
)
{
if
(
strstr
(
mount_list
[
i
],
"tmpfs /system"
)
||
strstr
(
mount_list
[
i
],
"tmpfs /vendor
/
"
)
if
(
strstr
(
mount_list
[
i
],
"tmpfs /system"
)
||
strstr
(
mount_list
[
i
],
"tmpfs /vendor"
)
||
(
strstr
(
mount_list
[
i
],
cache_block
)
&&
strstr
(
mount_list
[
i
],
"/system"
))
)
{
||
(
strstr
(
mount_list
[
i
],
cache_block
)
&&
strstr
(
mount_list
[
i
],
"/system"
))
)
{
sscanf
(
mount_list
[
i
],
"%*s %512s"
,
buffer
);
sscanf
(
mount_list
[
i
],
"%*s %512s"
,
buffer
);
lazy_unmount
(
buffer
);
lazy_unmount
(
buffer
);
...
...
scripts/magic_mask.sh
View file @
b4cfe6e9
...
@@ -2,7 +2,8 @@
...
@@ -2,7 +2,8 @@
LOGFILE
=
/cache/magisk.log
LOGFILE
=
/cache/magisk.log
IMG
=
/data/magisk.img
IMG
=
/data/magisk.img
BLACKLIST
=
"/system/lib /system/lib64 /system/etc /vendor/lib /vendor/lib64"
# BLACKLIST="/system/lib /system/lib64 /system/etc /system/framework /vendor/lib /vendor/lib64"
WHITELIST
=
"/system/app /system/priv-app /system/bin"
MOUNTPOINT
=
/magisk
MOUNTPOINT
=
/magisk
...
@@ -81,6 +82,9 @@ target_size_check() {
...
@@ -81,6 +82,9 @@ target_size_check() {
}
}
travel
()
{
travel
()
{
# Ignore /system/vendor, we will handle it differently
[
"
$1
"
=
"system/vendor"
]
&&
return
cd
$TRAVEL_ROOT
/
$1
cd
$TRAVEL_ROOT
/
$1
if
[
-f
.replace
]
;
then
if
[
-f
.replace
]
;
then
rm
-rf
$MOUNTINFO
/
$1
rm
-rf
$MOUNTINFO
/
$1
...
@@ -121,8 +125,8 @@ travel() {
...
@@ -121,8 +125,8 @@ travel() {
}
}
clone_dummy
()
{
clone_dummy
()
{
LINK
=
tru
e
LINK
=
fals
e
in_list
$1
"
$
BLACKLIST
"
&&
LINK
=
fals
e
in_list
$1
"
$
WHITELIST
"
&&
LINK
=
tru
e
for
ITEM
in
$MIRRDIR$1
/
*
;
do
for
ITEM
in
$MIRRDIR$1
/
*
;
do
REAL
=
${
ITEM
#
$MIRRDIR
}
REAL
=
${
ITEM
#
$MIRRDIR
}
...
@@ -353,11 +357,23 @@ case $1 in
...
@@ -353,11 +357,23 @@ case $1 in
# Remove crap folder
# Remove crap folder
rm
-rf
$MOUNTPOINT
/lost+found
rm
-rf
$MOUNTPOINT
/lost+found
# Link vendor if not exist
if
[
!
-e
/vendor
]
;
then
mount
-o
rw,remount rootfs /
ln
-s
/system/vendor /vendor
mount
-o
ro,remount rootfs /
fi
# Travel through all mods
# Travel through all mods
for
MOD
in
$MOUNTPOINT
/
*
;
do
for
MOD
in
$MOUNTPOINT
/
*
;
do
if
[
-f
$MOD
/auto_mount
-a
-d
$MOD
/system
-a
!
-f
$MOD
/disable
]
;
then
if
[
-f
$MOD
/auto_mount
-a
-d
$MOD
/system
-a
!
-f
$MOD
/disable
]
;
then
TRAVEL_ROOT
=
$MOD
TRAVEL_ROOT
=
$MOD
(
travel system
)
(
travel system
)
rm
-f
$MOD
/vendor 2>/dev/null
if
[
-d
$MOD
/system/vendor
]
;
then
ln
-s
$MOD
/system/vendor
$MOD
/vendor
(
travel vendor
)
fi
fi
fi
done
done
...
@@ -384,13 +400,13 @@ case $1 in
...
@@ -384,13 +400,13 @@ case $1 in
ln
-s
$MIRRDIR
/system/vendor
$MIRRDIR
/vendor
ln
-s
$MIRRDIR
/system/vendor
$MIRRDIR
/vendor
fi
fi
# Since mirrors always exist, we load libraries from mirrors
# Since mirrors always exist, we load libraries
and binaries
from mirrors
export
LD_LIBRARY_PATH
=
$MIRRDIR
/system/lib:
$MIRRDIR
/vendor/lib
export
LD_LIBRARY_PATH
=
$MIRRDIR
/system/lib:
$MIRRDIR
/vendor/lib
[
-d
/system/lib64
]
&&
export
LD_LIBRARY_PATH
=
$MIRRDIR
/system/lib64:
$MIRRDIR
/vendor/lib64
[
-d
$MIRRDIR
/system/lib64
]
&&
export
LD_LIBRARY_PATH
=
$MIRRDIR
/system/lib64:
$MIRRDIR
/vendor/lib64
# Stage 2
# Stage 2
log_print
"* Stage 2: Mount dummy skeletons"
log_print
"* Stage 2: Mount dummy skeletons"
# Move
dummy
/system/vendor to /vendor for consistency
# Move /system/vendor to /vendor for consistency
mv
-f
$MOUNTINFO
/dummy/system/vendor
$MOUNTINFO
/dummy/vendor 2>/dev/null
mv
-f
$MOUNTINFO
/dummy/system/vendor
$MOUNTINFO
/dummy/vendor 2>/dev/null
mv
-f
$DUMMDIR
/system/vendor
$DUMMDIR
/vendor 2>/dev/null
mv
-f
$DUMMDIR
/system/vendor
$DUMMDIR
/vendor 2>/dev/null
find
$MOUNTINFO
/dummy
-type
f 2>/dev/null |
while
read
ITEM
;
do
find
$MOUNTINFO
/dummy
-type
f 2>/dev/null |
while
read
ITEM
;
do
...
@@ -400,6 +416,9 @@ case $1 in
...
@@ -400,6 +416,9 @@ case $1 in
bind_mount
$ORIG
$TARGET
bind_mount
$ORIG
$TARGET
done
done
# Check if the dummy /system/bin is empty, it shouldn't
[
!
-e
$DUMMDIR
/system/bin/sh
]
&&
clone_dummy /system/bin
# Stage 3
# Stage 3
log_print
"* Stage 3: Mount module items"
log_print
"* Stage 3: Mount module items"
find
$MOUNTINFO
/system
-type
f 2>/dev/null |
while
read
ITEM
;
do
find
$MOUNTINFO
/system
-type
f 2>/dev/null |
while
read
ITEM
;
do
...
@@ -407,6 +426,11 @@ case $1 in
...
@@ -407,6 +426,11 @@ case $1 in
ORIG
=
`
cat
$ITEM
`
$TARGET
ORIG
=
`
cat
$ITEM
`
$TARGET
bind_mount
$ORIG
$TARGET
bind_mount
$ORIG
$TARGET
done
done
find
$MOUNTINFO
/vendor
-type
f 2>/dev/null |
while
read
ITEM
;
do
TARGET
=
${
ITEM
#
$MOUNTINFO
}
ORIG
=
`
cat
$ITEM
`
$TARGET
bind_mount
$ORIG
$TARGET
done
# Stage 4
# Stage 4
log_print
"* Stage 4: Execute module scripts"
log_print
"* Stage 4: Execute module scripts"
...
...
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