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
8f926c7c
Commit
8f926c7c
authored
Sep 27, 2017
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Load scripts in memory
parent
c562cbc2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
14 deletions
+16
-14
MagiskManager.java
app/src/main/java/com/topjohnwu/magisk/MagiskManager.java
+2
-14
Shell.java
app/src/main/java/com/topjohnwu/magisk/utils/Shell.java
+14
-0
No files found.
app/src/main/java/com/topjohnwu/magisk/MagiskManager.java
View file @
8f926c7c
...
...
@@ -31,11 +31,8 @@ import com.topjohnwu.magisk.utils.Shell;
import
com.topjohnwu.magisk.utils.Topic
;
import
com.topjohnwu.magisk.utils.Utils
;
import
java.io.File
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.OutputStream
;
import
java.util.List
;
import
java.util.Locale
;
import
java.util.Map
;
...
...
@@ -229,23 +226,14 @@ public class MagiskManager extends Application {
}
}
File
utils
=
new
File
(
getFilesDir
(),
Utils
.
UTIL_FUNCTIONS
);
try
(
InputStream
in
=
getAssets
().
open
(
Utils
.
UTIL_FUNCTIONS
);
OutputStream
out
=
new
FileOutputStream
(
utils
)
)
{
int
read
;
byte
[]
bytes
=
new
byte
[
4096
];
while
((
read
=
in
.
read
(
bytes
))
!=
-
1
)
{
out
.
write
(
bytes
,
0
,
read
);
}
try
(
InputStream
in
=
getAssets
().
open
(
Utils
.
UTIL_FUNCTIONS
))
{
shell
.
loadInputStream
(
in
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
shell
.
su_raw
(
"export PATH="
+
BUSYBOXPATH
+
":$PATH"
,
". "
+
utils
,
"mount_partitions"
,
"BOOTIMAGE="
,
"find_boot_image"
,
...
...
app/src/main/java/com/topjohnwu/magisk/utils/Shell.java
View file @
8f926c7c
...
...
@@ -9,6 +9,7 @@ import java.io.BufferedReader;
import
java.io.DataInputStream
;
import
java.io.DataOutputStream
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStreamReader
;
import
java.util.ArrayList
;
import
java.util.Collection
;
...
...
@@ -132,6 +133,19 @@ public class Shell {
return
rootStatus
>
0
;
}
public
void
loadInputStream
(
InputStream
in
)
{
try
{
int
read
;
byte
[]
bytes
=
new
byte
[
4096
];
while
((
read
=
in
.
read
(
bytes
))
!=
-
1
)
{
STDIN
.
write
(
bytes
,
0
,
read
);
}
STDIN
.
flush
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
public
List
<
String
>
sh
(
String
...
commands
)
{
List
<
String
>
res
=
new
ArrayList
<>();
if
(!
isValid
)
return
res
;
...
...
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