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
db501822
Commit
db501822
authored
Feb 04, 2017
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update busybox handling
parent
ef9948a9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
37 deletions
+49
-37
flash_script.sh
scripts/flash_script.sh
+15
-13
magic_mask.sh
scripts/magic_mask.sh
+34
-23
magisksu.sh
scripts/magisksu.sh
+0
-1
No files found.
scripts/flash_script.sh
View file @
db501822
...
@@ -320,18 +320,14 @@ fi
...
@@ -320,18 +320,14 @@ fi
ui_print
"- Constructing environment"
ui_print
"- Constructing environment"
if
(
is_mounted /data
)
;
then
if
(
is_mounted /data
)
;
then
rm
-rf
/data/
busybox /data/
magisk 2>/dev/null
rm
-rf
/data/magisk 2>/dev/null
mkdir
-p
/data/
busybox /data/
magisk
mkdir
-p
/data/magisk
cp
-af
$BINDIR
/busybox
$BINDIR
/sepolicy-inject
$BINDIR
/resetprop
\
cp
-af
$BINDIR
/busybox
$BINDIR
/sepolicy-inject
$BINDIR
/resetprop
\
$INSTALLER
/common/init.magisk.rc
$INSTALLER
/common/magic_mask.sh /data/magisk
$INSTALLER
/common/init.magisk.rc
$INSTALLER
/common/magic_mask.sh /data/magisk
cp
-af
$INSTALLER
/common/magisk.apk /data/magisk.apk
cp
-af
$INSTALLER
/common/magisk.apk /data/magisk.apk
/data/magisk/busybox
--install
-s
/data/busybox
chmod
-R
755 /data/magisk
ln
-s
/data/magisk/busybox /data/busybox/busybox
chcon
-h
u:object_r:system_file:s0 /data/magisk /data/magisk/
*
# Prevent issues
PATH
=
/data/busybox:
$PATH
rm
-f
/data/busybox/su /data/busybox/sh /data/busybox/reboot
chcon
-hR
u:object_r:system_file:s0 /data/magisk /data/busybox
chmod
-R
755 /data/magisk /data/busybox
# PATH=/data/busybox:$PATH
else
else
rm
-rf
/cache/data_bin 2>/dev/null
rm
-rf
/cache/data_bin 2>/dev/null
mkdir
-p
/cache/data_bin
mkdir
-p
/cache/data_bin
...
@@ -342,6 +338,13 @@ else
...
@@ -342,6 +338,13 @@ else
chmod
-R
755 /cache/data_bin
chmod
-R
755 /cache/data_bin
fi
fi
# Temporary busybox for installation
mkdir
-p
$TMPDIR
/busybox
$BINDIR
/busybox
--install
-s
$TMPDIR
/busybox
rm
-f
$TMPDIR
/busybox/su
$TMPDIR
/busybox/sh
$TMPDIR
/busybox/reboot
PATH
=
$TMPDIR
/busybox:
$PATH
##########################################################################################
##########################################################################################
# Image
# Image
##########################################################################################
##########################################################################################
...
@@ -486,11 +489,10 @@ else
...
@@ -486,11 +489,10 @@ else
# MagiskSU
# MagiskSU
ui_print
"- Installing MagiskSU"
ui_print
"- Installing MagiskSU"
rm
-rf
$COREDIR
/su 2>/dev/null
mkdir
-p
$COREDIR
/su 2>/dev/null
mkdir
-p
$COREDIR
/su
cp
-af
$BINDIR
/su
$INSTALLER
/common/magisksu.sh
$COREDIR
/su
cp
-af
$BINDIR
/su
$INSTALLER
/common/magisksu.sh
$COREDIR
/su
chmod
-R
755
$COREDIR
/su
chmod
755
$COREDIR
/su/su
$COREDIR
/su/magisksu.sh
chown
-R
0.0
$COREDIR
/su
chown
-R
0.0
$COREDIR
/su
/su
$COREDIR
/su/magisksu.sh
# Patch ramdisk
# Patch ramdisk
ui_print
"- Patching ramdisk"
ui_print
"- Patching ramdisk"
...
...
scripts/magic_mask.sh
View file @
db501822
...
@@ -15,8 +15,12 @@ MOUNTINFO=$TMPDIR/mnt
...
@@ -15,8 +15,12 @@ MOUNTINFO=$TMPDIR/mnt
# Use the included busybox for maximum compatibility and reliable results
# 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
# e.g. we rely on the option "-c" for cp (reserve contexts), and -exec for find
TOOLPATH
=
/d
ata
/busybox
TOOLPATH
=
/d
ev
/busybox
BINPATH
=
/data/magisk
BINPATH
=
/data/magisk
OLDPATH
=
$PATH
export
PATH
=
$TOOLPATH
:
$OLDPATH
APPDIR
=
/data/data/com.topjohnwu.magisk/files
# Default permissions
# Default permissions
umask
022
umask
022
...
@@ -273,24 +277,25 @@ case $1 in
...
@@ -273,24 +277,25 @@ case $1 in
mv
/cache/magisk.apk /data/magisk.apk 2>/dev/null
mv
/cache/magisk.apk /data/magisk.apk 2>/dev/null
mv
/cache/custom_ramdisk_patch.sh /data/custom_ramdisk_patch.sh 2>/dev/null
mv
/cache/custom_ramdisk_patch.sh /data/custom_ramdisk_patch.sh 2>/dev/null
if
[
-d
"/cache/data_bin"
]
;
then
if
[
-d
/cache/data_bin
]
;
then
rm
-rf
$BINPATH
$TOOLPATH
rm
-rf
$BINPATH
mkdir
-p
$TOOLPATH
mv
/cache/data_bin
$BINPATH
mv
/cache/data_bin
$BINPATH
$BINPATH
/busybox
--install
-s
$TOOLPATH
ln
-s
$BINPATH
/busybox
$TOOLPATH
/busybox
# Prevent issues
rm
-f
$TOOLPATH
/su
$TOOLPATH
/sh
$TOOLPATH
/reboot
fi
fi
chmod
-R
755
$BINPATH
chown
-R
0.0
$BINPATH
# Live patch sepolicy
# Live patch sepolicy
$BINPATH
/sepolicy-inject
--live
$BINPATH
/sepolicy-inject
--live
# Set up environment
# Set up environment
export
OLDPATH
=
$PATH
mkdir
-p
$TOOLPATH
export
PATH
=
$TOOLPATH
:
$OLDPATH
$BINPATH
/busybox
--install
-s
$TOOLPATH
chmod
-R
755
$BINPATH
$TOOLPATH
ln
-s
$BINPATH
/busybox
$TOOLPATH
/busybox
chown
-R
0.0
$BINPATH
$TOOLPATH
# 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
$BINPATH
$TOOLPATH
-exec
chcon
-h
u:object_r:system_file:s0
{}
\;
# Multirom functions should go here, not available right now
# Multirom functions should go here, not available right now
...
@@ -314,7 +319,7 @@ case $1 in
...
@@ -314,7 +319,7 @@ case $1 in
# Remove empty directories, legacy paths, symlinks, old temporary images
# Remove empty directories, legacy paths, symlinks, old temporary images
find
$MOUNTPOINT
-type
d
-depth
!
-path
"*core*"
-exec
rmdir
{}
\;
2>/dev/null
find
$MOUNTPOINT
-type
d
-depth
!
-path
"*core*"
-exec
rmdir
{}
\;
2>/dev/null
rm
-rf
$MOUNTPOINT
/zzsupersu
$MOUNTPOINT
/phh
$COREDIR
/bin
$COREDIR
/dummy
$COREDIR
/mirror /data/magisk/
*
.img 2>/dev/null
rm
-rf
$MOUNTPOINT
/zzsupersu
$MOUNTPOINT
/phh
$COREDIR
/bin
$COREDIR
/dummy
$COREDIR
/mirror /data/magisk/
*
.img
/data/busybox
2>/dev/null
# Remove modules that are labeled to be removed
# Remove modules that are labeled to be removed
for
MOD
in
$MOUNTPOINT
/
*
;
do
for
MOD
in
$MOUNTPOINT
/
*
;
do
...
@@ -343,7 +348,12 @@ case $1 in
...
@@ -343,7 +348,12 @@ case $1 in
fi
fi
# Start MagiskSU if no SuperSU
# Start MagiskSU if no SuperSU
export
PATH
=
$OLDPATH
[
!
-f
/sbin/launch_daemonsu.sh
]
&&
sh
$COREDIR
/su/magisksu.sh
[
!
-f
/sbin/launch_daemonsu.sh
]
&&
sh
$COREDIR
/su/magisksu.sh
export
PATH
=
$TOOLPATH
:
$OLDPATH
# Disable Magic Mount if specified
[
-f
$APPDIR
/disable
]
&&
unblock
log_print
"* Preparing modules"
log_print
"* Preparing modules"
...
@@ -441,16 +451,6 @@ case $1 in
...
@@ -441,16 +451,6 @@ case $1 in
bind_mount
$COREDIR
/hosts /system/etc/hosts
bind_mount
$COREDIR
/hosts /system/etc/hosts
fi
fi
# Expose busybox
if
[
-f
$COREDIR
/busybox/enable
]
;
then
log_print
"* Enabling BusyBox"
cp
-afc
/data/busybox/.
$COREDIR
/busybox
cp
-afc
/system/xbin/.
$COREDIR
/busybox
chmod
-R
755
$COREDIR
/busybox
chcon
-hR
u:object_r:system_file:s0
$COREDIR
/busybox
bind_mount
$COREDIR
/busybox /system/xbin
fi
if
[
-f
/data/magisk.apk
]
;
then
if
[
-f
/data/magisk.apk
]
;
then
if
[
-z
`
ls
/data/app |
grep
com.topjohnwu.magisk
`
]
;
then
if
[
-z
`
ls
/data/app |
grep
com.topjohnwu.magisk
`
]
;
then
mkdir
/data/app/com.topjohnwu.magisk-1
mkdir
/data/app/com.topjohnwu.magisk-1
...
@@ -480,9 +480,20 @@ case $1 in
...
@@ -480,9 +480,20 @@ case $1 in
/data/magisk/resetprop
--file
$MOD
/system.prop
/data/magisk/resetprop
--file
$MOD
/system.prop
fi
fi
done
done
# Expose busybox
[
"
`
getprop persist.magisk.busybox
`
"
=
"1"
]
&&
sh /sbin/magic_mask.sh mount_busybox
unblock
unblock
;;
;;
mount_busybox
)
log_print
"* Enabling BusyBox"
cp
-afc
/system/xbin/.
$TOOLPATH
umount /system/xbin 2>/dev/null
bind_mount
$TOOLPATH
/system/xbin
;;
service
)
service
)
# Version info
# Version info
MAGISK_VERSION_STUB
MAGISK_VERSION_STUB
...
...
scripts/magisksu.sh
View file @
db501822
...
@@ -2,7 +2,6 @@
...
@@ -2,7 +2,6 @@
MODDIR
=
${
0
%/*
}
MODDIR
=
${
0
%/*
}
LOGFILE
=
/cache/magisk.log
LOGFILE
=
/cache/magisk.log
PATH
=
$OLDPATH
log_print
()
{
log_print
()
{
echo
"MagiskSU:
$1
"
echo
"MagiskSU:
$1
"
...
...
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