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
8c7fbe20
Commit
8c7fbe20
authored
Mar 26, 2017
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Daemons cannot run in /data on Samsung, move to magisk.img
parent
469aba8e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
53 additions
and
53 deletions
+53
-53
magiskpolicy
jni/magiskpolicy
+1
-1
flash_script.sh
scripts/flash_script.sh
+8
-5
magic_mask.sh
scripts/magic_mask.sh
+42
-45
enable
zip_static/common/magiskhide/enable
+2
-2
No files found.
magiskpolicy
@
f66a820e
Subproject commit
2e6bea23acc073aa9b3890c50342dd4a3dc8e754
Subproject commit
f66a820e14e1df23948b06dbe631c781c029abe0
scripts/flash_script.sh
View file @
8c7fbe20
...
...
@@ -248,8 +248,8 @@ is_mounted /data && MAGISKBIN=/data/magisk || MAGISKBIN=/cache/data_bin
# Copy required files
rm
-rf
$MAGISKBIN
2>/dev/null
mkdir
-p
$MAGISKBIN
cp
-af
$BINDIR
/
.
$COMMONDIR
/ramdisk_patch.sh
$COMMONDIR
/magic_mask.sh
\
$COMMONDIR
/init.magisk.rc
$COMMONDIR
/magisk.apk
$MAGISKBIN
cp
-af
$BINDIR
/
busybox
$BINDIR
/magiskboot
$BINDIR
/magiskpolicy
$COMMONDIR
/magisk.apk
\
$COMMONDIR
/init.magisk.rc
$COMMONDIR
/ramdisk_patch.sh
$COMMONDIR
/magic_mask.sh
$MAGISKBIN
# Legacy support
ln
-sf
/data/magisk/magiskpolicy
$MAGISKBIN
/sepolicy-inject
...
...
@@ -292,10 +292,13 @@ fi
MAGISKLOOP
=
$LOOPDEVICE
# Core folders and scripts
mkdir
-p
$COREDIR
/magiskhide
$COREDIR
/post-fs-data.d
$COREDIR
/service.d 2>/dev/null
mkdir
-p
$COREDIR
/
bin
$COREDIR
/
magiskhide
$COREDIR
/post-fs-data.d
$COREDIR
/service.d 2>/dev/null
cp
-af
$COMMONDIR
/magiskhide/.
$COREDIR
/magiskhide
chmod
-R
755
$COREDIR
/magiskhide
$COREDIR
/post-fs-data.d
$COREDIR
/service.d
chown
-R
0.0
$COREDIR
/magiskhide
$COREDIR
/post-fs-data.d
$COREDIR
/service.d
cp
-af
$BINDIR
/resetprop
$BINDIR
/magiskhide
$BINDIR
/su
$COREDIR
/bin
# Legacy support
ln
-sf
$COREDIR
/bin/resetprop
$MAGISKBIN
/resetprop
chmod
-R
755
$COREDIR
/bin
$COREDIR
/magiskhide
$COREDIR
/post-fs-data.d
$COREDIR
/service.d
chown
-R
0.0
$COREDIR
/bin
$COREDIR
/magiskhide
$COREDIR
/post-fs-data.d
$COREDIR
/service.d
##########################################################################################
# Unpack boot
...
...
scripts/magic_mask.sh
View file @
8c7fbe20
...
...
@@ -7,7 +7,6 @@ IMG=/data/magisk.img
WHITELIST
=
"/system/bin"
MOUNTPOINT
=
/magisk
COREDIR
=
$MOUNTPOINT
/.core
TMPDIR
=
/dev/magisk
...
...
@@ -18,7 +17,8 @@ MOUNTINFO=$TMPDIR/mnt
# Use the included busybox for maximum compatibility and reliable results
# e.g. we rely on the option "-c" for cp (reserve contexts), and -exec for find
TOOLPATH
=
/dev/busybox
BINPATH
=
/data/magisk
DATABIN
=
/data/magisk
MAGISKBIN
=
$COREDIR
/bin
OLDPATH
=
$PATH
export
PATH
=
$TOOLPATH
:
$OLDPATH
...
...
@@ -297,54 +297,29 @@ case $1 in
# Cache support
mv
/cache/stock_boot
*
/data 2>/dev/null
if
[
-d
/cache/data_bin
]
;
then
rm
-rf
$BINPATH
mv
/cache/data_bin
$BINPATH
rm
-rf
$DATABIN
mv
/cache/data_bin
$DATABIN
chmod
-R
755
$DATABIN
chown
-R
0.0
$DATABIN
fi
chmod
-R
755
$BINPATH
chown
-R
0.0
$BINPATH
# Live patch sepolicy
$BINPATH
/magiskpolicy
--live
if
[
-f
$UNINSTALLER
]
;
then
touch
/dev/.magisk.unblock
chcon
u:object_r:device:s0 /dev/.magisk.unblock
BOOTMODE
=
true
sh
$UNINSTALLER
exit
fi
$DATABIN
/magiskpolicy
--live
# Set up environment
mkdir
-p
$TOOLPATH
$
BINPATH
/busybox
--install
-s
$TOOLPATH
ln
-sf
$
BINPATH
/busybox
$TOOLPATH
/busybox
$
DATABIN
/busybox
--install
-s
$TOOLPATH
ln
-sf
$
DATABIN
/busybox
$TOOLPATH
/busybox
# Prevent issues
rm
-f
$TOOLPATH
/su
$TOOLPATH
/sh
$TOOLPATH
/reboot
chmod
-R
755
$TOOLPATH
chown
-R
0.0
$TOOLPATH
find
$BINPATH
$TOOLPATH
-exec
chcon
-h
u:object_r:system_file:s0
{}
\;
find
$DATABIN
$TOOLPATH
-exec
chcon
-h
u:object_r:system_file:s0
{}
\;
log_print
"* Linking binaries to /sbin"
mount
-o
rw,remount rootfs /
chmod
755 /sbin
ln
-sf
$BINPATH
/magiskpolicy /sbin/magiskpolicy
ln
-sf
$BINPATH
/magiskpolicy /sbin/sepolicy-inject
ln
-sf
$BINPATH
/resetprop /sbin/resetprop
if
[
!
-f
/sbin/launch_daemonsu.sh
]
;
then
log_print
"* Starting MagiskSU"
export
PATH
=
$OLDPATH
ln
-sf
$BINPATH
/su /sbin/su
ln
-sf
$BINPATH
/magiskpolicy /sbin/supolicy
/sbin/su
--daemon
export
PATH
=
$TOOLPATH
:
$OLDPATH
if
[
-f
$UNINSTALLER
]
;
then
touch
/dev/.magisk.unblock
chcon
u:object_r:device:s0 /dev/.magisk.unblock
BOOTMODE
=
true
sh
$UNINSTALLER
exit
fi
mount
-o
ro,remount rootfs /
# Exit if disabled
[
-f
$DISABLEFILE
]
&&
unblock
# Multirom functions should go here, not available right now
MULTIROM
=
false
# Image merging
chmod
644
$IMG
/cache/magisk.img /data/magisk_merge.img 2>/dev/null
...
...
@@ -364,7 +339,7 @@ case $1 in
# Remove empty directories, legacy paths, symlinks, old temporary images
find
$MOUNTPOINT
-type
d
-depth
!
-path
"*core*"
-exec
rmdir
{}
\;
2>/dev/null
rm
-rf
$MOUNTPOINT
/zzsupersu
$MOUNTPOINT
/phh
$COREDIR
/
bin
$COREDIR
/
dummy
$COREDIR
/mirror
\
rm
-rf
$MOUNTPOINT
/zzsupersu
$MOUNTPOINT
/phh
$COREDIR
/dummy
$COREDIR
/mirror
\
$COREDIR
/busybox
$COREDIR
/su /data/magisk/
*
.img /data/busybox 2>/dev/null
# Remove modules that are labeled to be removed
...
...
@@ -393,6 +368,28 @@ case $1 in
fi
fi
log_print
"* Linking binaries to /sbin"
mount
-o
rw,remount rootfs /
chmod
755 /sbin
ln
-sf
$DATABIN
/magiskpolicy /sbin/magiskpolicy
ln
-sf
$DATABIN
/magiskpolicy /sbin/sepolicy-inject
ln
-sf
$MAGISKBIN
/resetprop /sbin/resetprop
if
[
!
-f
/sbin/launch_daemonsu.sh
]
;
then
log_print
"* Starting MagiskSU"
export
PATH
=
$OLDPATH
ln
-sf
$MAGISKBIN
/su /sbin/su
ln
-sf
$DATABIN
/magiskpolicy /sbin/supolicy
/sbin/su
--daemon
export
PATH
=
$TOOLPATH
:
$OLDPATH
fi
mount
-o
ro,remount rootfs /
# Exit if disabled
[
-f
$DISABLEFILE
]
&&
unblock
# Multirom functions should go here, not available right now
MULTIROM
=
false
log_print
"* Preparing modules"
# Remove crap folder
...
...
@@ -421,7 +418,7 @@ case $1 in
# Read in defined system props
if
[
-f
$MOD
/system.prop
]
;
then
log_print
"* Reading props from
$MOD
/system.prop"
$
BINPATH
/resetprop
--file
$MOD
/system.prop
$
MAGISKBIN
/resetprop
--file
$MOD
/system.prop
fi
fi
done
...
...
@@ -494,10 +491,10 @@ case $1 in
bind_mount
$COREDIR
/hosts /system/etc/hosts
fi
if
[
-f
$
BINPATH
/magisk.apk
]
;
then
if
[
-f
$
DATABIN
/magisk.apk
]
;
then
if
!
ls
/data/app |
grep
com.topjohnwu.magisk
;
then
mkdir
/data/app/com.topjohnwu.magisk-1
cp
$
BINPATH
/magisk.apk /data/app/com.topjohnwu.magisk-1/base.apk
cp
$
DATABIN
/magisk.apk /data/app/com.topjohnwu.magisk-1/base.apk
chown
1000.1000 /data/app/com.topjohnwu.magisk-1
chown
1000.1000 /data/app/com.topjohnwu.magisk-1/base.apk
chmod
755 /data/app/com.topjohnwu.magisk-1
...
...
@@ -505,7 +502,7 @@ case $1 in
chcon
u:object_r:apk_data_file:s0 /data/app/com.topjohnwu.magisk-1
chcon
u:object_r:apk_data_file:s0 /data/app/com.topjohnwu.magisk-1/base.apk
fi
rm
-f
$
BINPATH
/magisk.apk 2>/dev/null
rm
-f
$
DATABIN
/magisk.apk 2>/dev/null
fi
# Expose busybox
...
...
zip_static/common/magiskhide/enable
View file @
8c7fbe20
#!/system/bin/sh
MODDIR
=
/magisk/.core/magiskhide
BINPATH
=
/
data/magisk
BINPATH
=
/
magisk/.core/bin
LOGFILE
=
/cache/magisk.log
TOOLPATH
=
/dev/busybox
...
...
@@ -23,7 +23,7 @@ if [ ! -d /sbin_orig ]; then
mkdir
-p
/dev/sbin_bind
chmod
755 /dev/sbin_bind
ln
-s
/sbin_orig/
*
/dev/sbin_bind
chcon
-h
u:object_r:
rootfs
:s0 /dev/sbin_bind /dev/sbin_bind/
*
chcon
-h
u:object_r:
system_file
:s0 /dev/sbin_bind /dev/sbin_bind/
*
mount
-o
bind
/dev/sbin_bind /sbin
fi
...
...
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