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
7fc9b908
Commit
7fc9b908
authored
Jul 27, 2020
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update Android 11 emulator support
parent
0ed524f1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
15 deletions
+45
-15
restorecon.cpp
native/jni/core/restorecon.cpp
+7
-0
emulator.sh
scripts/emulator.sh
+38
-15
No files found.
native/jni/core/restorecon.cpp
View file @
7fc9b908
...
@@ -79,6 +79,13 @@ void restorecon() {
...
@@ -79,6 +79,13 @@ void restorecon() {
}
}
void
restore_tmpcon
()
{
void
restore_tmpcon
()
{
if
(
MAGISKTMP
==
"/system/bin"
)
{
// Running with emulator.sh
if
(
SDK_INT
>=
26
)
lsetfilecon
(
"/system/bin/magisk"
,
EXEC_CON
);
return
;
}
if
(
MAGISKTMP
==
"/sbin"
)
if
(
MAGISKTMP
==
"/sbin"
)
setfilecon
(
MAGISKTMP
.
data
(),
ROOT_CON
);
setfilecon
(
MAGISKTMP
.
data
(),
ROOT_CON
);
else
else
...
...
scripts/emulator.sh
View file @
7fc9b908
...
@@ -43,15 +43,24 @@ fi
...
@@ -43,15 +43,24 @@ fi
cd
/data/local/tmp
cd
/data/local/tmp
chmod
777 busybox
chmod
777 busybox
chmod
777 magiskinit
chmod
777 magiskinit
./magiskinit
-x
magisk magisk
if
[
`
./busybox
id
-u
`
-ne
0
]
;
then
if
[
-z
"
$FIRST_STAGE
"
]
;
then
# Re-exec script with root
export
FIRST_STAGE
=
1
exec
/system/xbin/su 0 ./busybox sh
-o
standalone
$0
export
ASH_STANDALONE
=
1
if
[
`
./busybox
id
-u
`
-ne
0
]
;
then
# Re-exec script with root
exec
/system/xbin/su 0 ./busybox sh
$0
else
# Re-exec script with busybox
exec
./busybox sh
$0
fi
fi
fi
# Remove previous setup if exist
# Remove previous setup if exist
pgrep magiskd
>
/dev/null
&&
pkill
-9
magiskd
pgrep magiskd
>
/dev/null
&&
pkill
-9
magiskd
[
-f
/sbin/magisk
]
&&
umount
-l
/sbin
[
-f
/sbin/magisk
]
&&
umount
-l
/sbin
[
-f
/system/bin/magisk
]
&&
umount
-l
/system/bin
# SELinux stuffs
# SELinux stuffs
[
-e
/sys/fs/selinux
]
&&
SELINUX
=
true
||
SELINUX
=
false
[
-e
/sys/fs/selinux
]
&&
SELINUX
=
true
||
SELINUX
=
false
...
@@ -60,8 +69,11 @@ if $SELINUX; then
...
@@ -60,8 +69,11 @@ if $SELINUX; then
./magiskpolicy
--live
--magisk
./magiskpolicy
--live
--magisk
fi
fi
# Setup sbin overlay
BINDIR
=
/sbin
# Setup bin overlay
if
mount |
grep
-q
rootfs
;
then
if
mount |
grep
-q
rootfs
;
then
# Legacy rootfs
mount
-o
rw,remount /
mount
-o
rw,remount /
rm
-rf
/root
rm
-rf
/root
mkdir
/root
mkdir
/root
...
@@ -70,12 +82,15 @@ if mount | grep -q rootfs; then
...
@@ -70,12 +82,15 @@ if mount | grep -q rootfs; then
mount
-o
ro,remount /
mount
-o
ro,remount /
mount_sbin
mount_sbin
ln
-s
/root/
*
/sbin
ln
-s
/root/
*
/sbin
else
elif
[
-e
/sbin
]
;
then
# Legacy SAR
mount_sbin
mount_sbin
mkdir
-p
/sbin/.magisk/mirror/system_root
if
!
grep
-q
'/sbin/.magisk/mirror/system_root'
/proc/mounts
;
then
block
=
`
mount |
grep
' / '
|
awk
'{ print $1 }'
`
mkdir
-p
/sbin/.magisk/mirror/system_root
[
$block
=
"/dev/root"
]
&&
block
=
/dev/block/dm-0
block
=
`
mount |
grep
' / '
|
awk
'{ print $1 }'
`
mount
-o
ro
$block
/sbin/.magisk/mirror/system_root
[
$block
=
"/dev/root"
]
&&
block
=
/dev/block/dm-0
mount
-o
ro
$block
/sbin/.magisk/mirror/system_root
fi
for
file
in
/sbin/.magisk/mirror/system_root/sbin/
*
;
do
for
file
in
/sbin/.magisk/mirror/system_root/sbin/
*
;
do
[
!
-e
$file
]
&&
break
[
!
-e
$file
]
&&
break
if
[
-L
$file
]
;
then
if
[
-L
$file
]
;
then
...
@@ -86,15 +101,23 @@ else
...
@@ -86,15 +101,23 @@ else
mount
-o
bind
$file
$sfile
mount
-o
bind
$file
$sfile
fi
fi
done
done
else
# Android Q+ without sbin, use overlayfs
BINDIR
=
/system/bin
rm
-rf
/dev/magisk
mkdir
-p
/dev/magisk/upper
mkdir
/dev/magisk/work
./magisk
--clone-attr
/system/bin /dev/magisk/upper
mount
-t
overlay overlay
-olowerdir
=
/system/bin,upperdir
=
/dev/magisk/upper,workdir
=
/dev/magisk/work /system/bin
fi
fi
# Magisk stuffs
# Magisk stuffs
./magiskinit
-x
magisk
/sbin
/magisk
./magiskinit
-x
magisk
$BINDIR
/magisk
chmod
755
/sbin
/magisk
chmod
755
$BINDIR
/magisk
ln
-s
./magisk
/sbin
/su
ln
-s
./magisk
$BINDIR
/su
ln
-s
./magisk
/sbin
/resetprop
ln
-s
./magisk
$BINDIR
/resetprop
ln
-s
./magisk
/sbin
/magiskhide
ln
-s
./magisk
$BINDIR
/magiskhide
mkdir
-p
/data/adb/modules 2>/dev/null
mkdir
-p
/data/adb/modules 2>/dev/null
mkdir
/data/adb/post-fs-data.d 2>/dev/null
mkdir
/data/adb/post-fs-data.d 2>/dev/null
mkdir
/data/adb/services.d 2>/dev/null
mkdir
/data/adb/services.d 2>/dev/null
/sbin
/magisk
--daemon
$BINDIR
/magisk
--daemon
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