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
ed7e5608
Commit
ed7e5608
authored
Mar 19, 2020
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix ensure_bb implementation
Close #2549, close #2560
parent
47e50e85
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
8 deletions
+25
-8
util_functions.sh
scripts/util_functions.sh
+25
-8
No files found.
scripts/util_functions.sh
View file @
ed7e5608
...
...
@@ -86,23 +86,40 @@ setup_flashable() {
}
ensure_bb
()
{
[
-o
standalone
]
&&
return
set
-o
standalone 2>/dev/null
&&
return
if
set
-o
|
grep
-q
standalone
;
then
# We are definitely in busybox ash
set
-o
standalone
return
fi
# At this point, we are not running in BusyBox ash
# Find our busybox binary
local
BUSYBOX
local
bb
if
[
-f
$TMPDIR
/busybox
]
;
then
BUSYBOX
=
$TMPDIR
/busybox
bb
=
$TMPDIR
/busybox
elif
[
-f
$MAGISKBIN
/busybox
]
;
then
BUSYBOX
=
$MAGISKBIN
/busybox
bb
=
$MAGISKBIN
/busybox
else
abort
"! Cannot find BusyBox"
fi
chmod
755
$bb
# Find our current arguments
# Run in busybox environment to ensure consistent results
# /proc/<pid>/cmdline shall be <interpreter> <script> <arguments...>
local
cmds
=
$(
$bb
sh
-o
standalone
-c
"
tr '
\0
' '
\n
' < /proc/
$$
/cmdline | (while read -r arg; do
if [ -z
\"\$
cmds
\"
]; then
# Skip the first argument as we want to change the interpreter
cmds=
\"
sh -o standalone
\"
else
cmds=
\"\$
cmds '
\$
arg'
\"
fi
done
echo
\$
cmds)"
)
# Re-exec our script
chmod
755
$BUSYBOX
ex
ec
$BUSYBOX
sh
-o
standalone
$0
"
$@
"
echo
$cmds
|
$bb
xargs
$bb
ex
it
}
recovery_actions
()
{
...
...
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