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
e261579e
Commit
e261579e
authored
Mar 11, 2020
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use standalone mode in boot scripts
parent
cf54cad3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
15 deletions
+7
-15
scripting.cpp
native/jni/core/scripting.cpp
+7
-15
No files found.
native/jni/core/scripting.cpp
View file @
e261579e
...
...
@@ -10,18 +10,13 @@
using
namespace
std
;
static
void
set_path
()
{
char
buf
[
4096
];
sprintf
(
buf
,
BBPATH
":%s"
,
getenv
(
"PATH"
));
setenv
(
"PATH"
,
buf
,
1
);
}
#define BBEXEC_CMD DATABIN "/busybox", "sh", "-o", "standalone"
void
exec_script
(
const
char
*
script
)
{
exec_t
exec
{
.
pre_exec
=
set_path
,
.
fork
=
fork_no_zombie
};
exec_command_sync
(
exec
,
"/system/bin/sh"
,
script
);
exec_command_sync
(
exec
,
BBEXEC_CMD
,
script
);
}
void
exec_common_script
(
const
char
*
stage
)
{
...
...
@@ -42,13 +37,12 @@ void exec_common_script(const char *stage) {
LOGI
(
"%s.d: exec [%s]
\n
"
,
stage
,
entry
->
d_name
);
strcpy
(
name
,
entry
->
d_name
);
exec_t
exec
{
.
pre_exec
=
set_path
,
.
fork
=
pfs
?
fork_no_zombie
:
fork_dont_care
};
if
(
pfs
)
exec_command_sync
(
exec
,
"/system/bin/sh"
,
path
);
exec_command_sync
(
exec
,
BBEXEC_CMD
,
path
);
else
exec_command
(
exec
,
"/system/bin/sh"
,
path
);
exec_command
(
exec
,
BBEXEC_CMD
,
path
);
}
}
}
...
...
@@ -63,13 +57,12 @@ void exec_module_script(const char *stage, const vector<string> &module_list) {
continue
;
LOGI
(
"%s: exec [%s.sh]
\n
"
,
module
,
stage
);
exec_t
exec
{
.
pre_exec
=
set_path
,
.
fork
=
pfs
?
fork_no_zombie
:
fork_dont_care
};
if
(
pfs
)
exec_command_sync
(
exec
,
"/system/bin/sh"
,
path
);
exec_command_sync
(
exec
,
BBEXEC_CMD
,
path
);
else
exec_command
(
exec
,
"/system/bin/sh"
,
path
);
exec_command
(
exec
,
BBEXEC_CMD
,
path
);
}
}
...
...
@@ -83,10 +76,9 @@ rm -f $APK
void
install_apk
(
const
char
*
apk
)
{
setfilecon
(
apk
,
"u:object_r:"
SEPOL_FILE_DOMAIN
":s0"
);
exec_t
exec
{
.
pre_exec
=
set_path
,
.
fork
=
fork_no_zombie
};
char
cmds
[
sizeof
(
install_script
)
+
4096
];
sprintf
(
cmds
,
install_script
,
apk
);
exec_command_sync
(
exec
,
"/system/bin/sh"
,
"-c"
,
cmds
);
exec_command_sync
(
exec
,
BBEXEC_CMD
,
"-c"
,
cmds
);
}
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