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
f63af060
Commit
f63af060
authored
Aug 30, 2017
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support Magisk Manager boot image file patch
parent
189c671c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
15 deletions
+21
-15
bootstages.c
jni/daemon/bootstages.c
+4
-5
boot_patch.sh
scripts/boot_patch.sh
+9
-8
update_binary.sh
scripts/update_binary.sh
+8
-2
No files found.
jni/daemon/bootstages.c
View file @
f63af060
...
@@ -553,18 +553,17 @@ void post_fs_data(int client) {
...
@@ -553,18 +553,17 @@ void post_fs_data(int client) {
char
*
bin_path
=
NULL
;
char
*
bin_path
=
NULL
;
if
(
access
(
"/cache/data_bin"
,
F_OK
)
==
0
)
if
(
access
(
"/cache/data_bin"
,
F_OK
)
==
0
)
bin_path
=
"/cache/data_bin"
;
bin_path
=
"/cache/data_bin"
;
else
if
(
access
(
"/data/
local/tmp/magisk_inject
"
,
F_OK
)
==
0
)
else
if
(
access
(
"/data/
data/com.topjohnwu.magisk/install
"
,
F_OK
)
==
0
)
bin_path
=
"/data/
local/tmp/magisk_inject
"
;
bin_path
=
"/data/
data/com.topjohnwu.magisk/install
"
;
if
(
bin_path
)
{
if
(
bin_path
)
{
exec_command_sync
(
"rm"
,
"-rf"
,
DATABIN
,
NULL
);
exec_command_sync
(
"rm"
,
"-rf"
,
DATABIN
,
NULL
);
exec_command_sync
(
"cp"
,
"-r"
,
bin_path
,
DATABIN
,
NULL
);
exec_command_sync
(
"cp"
,
"-r"
,
bin_path
,
DATABIN
,
NULL
);
exec_command_sync
(
"rm"
,
"-rf"
,
bin_path
,
NULL
);
exec_command_sync
(
"rm"
,
"-rf"
,
bin_path
,
NULL
);
exec_command_sync
(
"chmod"
,
"-R"
,
"755"
,
bin_path
,
NULL
);
exec_command_sync
(
"chmod"
,
"-R"
,
"755"
,
bin_path
,
NULL
);
// Lazy.... use shell blob to match files
exec_command_sync
(
"sh"
,
"-c"
,
"mv /data/magisk/stock_boot* /data"
,
NULL
);
}
}
// Lazy.... use shell blob to match files
exec_command_sync
(
"sh"
,
"-c"
,
"mv /data/magisk/stock_boot* /data"
,
NULL
);
// Link busybox
// Link busybox
mount_mirrors
();
mount_mirrors
();
link_busybox
();
link_busybox
();
...
...
scripts/boot_patch.sh
View file @
f63af060
...
@@ -49,12 +49,15 @@ abort_wrap() {
...
@@ -49,12 +49,15 @@ abort_wrap() {
# Pure bash dirname implementation
# Pure bash dirname implementation
dirname_wrap
()
{
dirname_wrap
()
{
if
echo
$1
|
grep
"/"
>
/dev/null 2>&1
;
then
case
"
$1
"
in
RES
=
${
1
%/*
}
*
/
*
)
[
-z
$RES
]
&&
echo
"/"
||
echo
$RES
dir
=
${
1
%/*
}
else
[
-z
$dir
]
&&
echo
"/"
||
echo
$dir
echo
"."
;;
fi
*
)
echo
"."
;;
esac
}
}
# Pure bash basename implementation
# Pure bash basename implementation
...
@@ -93,10 +96,8 @@ cpio_mkdir() {
...
@@ -93,10 +96,8 @@ cpio_mkdir() {
[
-z
$1
]
&&
abort_wrap
"This script requires a boot image as a parameter"
[
-z
$1
]
&&
abort_wrap
"This script requires a boot image as a parameter"
CWD
=
`
pwd
`
cd
"
`
dirname_wrap
$1
`
"
cd
"
`
dirname_wrap
$1
`
"
BOOTIMAGE
=
"
`
pwd
`
/
`
basename_wrap
$1
`
"
BOOTIMAGE
=
"
`
pwd
`
/
`
basename_wrap
$1
`
"
cd
"
$CWD
"
[
-e
"
$BOOTIMAGE
"
]
||
abort_wrap
"
$BOOTIMAGE
does not exist!"
[
-e
"
$BOOTIMAGE
"
]
||
abort_wrap
"
$BOOTIMAGE
does not exist!"
...
...
scripts/update_binary.sh
View file @
f63af060
# EX_ARM, EX_X86, BB_ARM, and BB_X86 should be generated in build.py
# EX_ARM, EX_X86, BB_ARM, and BB_X86 should be generated in build.py
dirname_wrap
()
{
case
"
$1
"
in
*
/
*
)
dir
=
${
1
%/*
}
;
[
-z
$dir
]
&&
echo
"/"
||
echo
$dir
;;
*
)
echo
"."
;;
esac
}
[
"
$1
"
=
"indep"
]
&&
INDEP
=
true
||
INDEP
=
false
[
"
$1
"
=
"indep"
]
&&
INDEP
=
true
||
INDEP
=
false
$INDEP
&&
TMPDIR
=
/data/local/tmp
||
TMPDIR
=
/dev/tmp
$INDEP
&&
TMPDIR
=
"
`
cd
"
\`
dirname_wrap "
${
BASH_SOURCE
:-
$0
}
"
\`
"
&&
pwd
`
"
||
TMPDIR
=
/dev/tmp
INSTALLER
=
$TMPDIR
/install
;
BBDIR
=
$TMPDIR
/bin
INSTALLER
=
$TMPDIR
/install
;
BBDIR
=
$TMPDIR
/bin
EXBIN
=
$BBDIR
/b64xz
;
BBBIN
=
$BBDIR
/busybox
EXBIN
=
$BBDIR
/b64xz
;
BBBIN
=
$BBDIR
/busybox
$INDEP
||
rm
-rf
$TMPDIR
2>/dev/null
;
$INDEP
||
rm
-rf
$TMPDIR
2>/dev/null
;
...
@@ -17,7 +23,7 @@ $BBBIN --install -s $TMPDIR/bin
...
@@ -17,7 +23,7 @@ $BBBIN --install -s $TMPDIR/bin
export
PATH
=
$BBDIR
:
$PATH
export
PATH
=
$BBDIR
:
$PATH
if
$INDEP
;
then
if
$INDEP
;
then
shift
shift
exec
sh
$@
exec
sh
"
$@
"
else
else
mkdir
-p
$INSTALLER
mkdir
-p
$INSTALLER
unzip
-o
"
$3
"
-d
$INSTALLER
unzip
-o
"
$3
"
-d
$INSTALLER
...
...
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