summaryrefslogtreecommitdiffhomepage
path: root/app/src/main
diff options
context:
space:
mode:
authorSamuel Holland <samuel@sholland.org>2017-08-04 00:37:58 -0500
committerSamuel Holland <samuel@sholland.org>2017-08-04 00:37:58 -0500
commit4b401a368fefa2099a3e33d9c4b7a9fb05dd35c4 (patch)
tree160728b95957ad2ecbcdb39b9fb040df89a453f1 /app/src/main
parentf0ac53e29b117375f3a276220d4c1a35573c6031 (diff)
RootShell: Make shell command configurable
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/java/com/wireguard/android/RootShell.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/app/src/main/java/com/wireguard/android/RootShell.java b/app/src/main/java/com/wireguard/android/RootShell.java
index c060c967..f5879f00 100644
--- a/app/src/main/java/com/wireguard/android/RootShell.java
+++ b/app/src/main/java/com/wireguard/android/RootShell.java
@@ -24,10 +24,16 @@ class RootShell {
private static final String TAG = "RootShell";
private final byte setupCommands[];
+ private final String shell;
RootShell(Context context) {
+ this(context, "su");
+ }
+
+ RootShell(Context context, String shell) {
final String tmpdir = context.getCacheDir().getPath();
setupCommands = String.format(SETUP_TEMPLATE, tmpdir).getBytes(StandardCharsets.UTF_8);
+ this.shell = shell;
}
/**
@@ -45,7 +51,7 @@ class RootShell {
int exitValue = -1;
try {
final ProcessBuilder builder = new ProcessBuilder().redirectErrorStream(true);
- final Process process = builder.command("su").start();
+ final Process process = builder.command(shell).start();
final OutputStream stdin = process.getOutputStream();
stdin.write(setupCommands);
for (String command : commands)