summaryrefslogtreecommitdiffhomepage
path: root/app/src
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-01-09 12:20:44 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2018-01-09 13:12:49 +0100
commit1451c4baf5a66c601b6fec937e2e9c229c5336bf (patch)
treeb9576a42e19d566b3e46f7dfe7c1207848df43cf /app/src
parent2785def37a8d64906b9d4e2c213c7d387cfb18af (diff)
ToolsInstaller: terminators are better than seperators
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'app/src')
-rw-r--r--app/src/main/java/com/wireguard/android/util/ToolsInstaller.java14
1 files changed, 7 insertions, 7 deletions
diff --git a/app/src/main/java/com/wireguard/android/util/ToolsInstaller.java b/app/src/main/java/com/wireguard/android/util/ToolsInstaller.java
index 5042abe6..b2f6e22a 100644
--- a/app/src/main/java/com/wireguard/android/util/ToolsInstaller.java
+++ b/app/src/main/java/com/wireguard/android/util/ToolsInstaller.java
@@ -66,7 +66,7 @@ public final class ToolsInstaller {
new File(nativeLibraryDir, names[0]),
new File(INSTALL_DIR, names[1])));
}
- script.append("exit ").append(OsConstants.EALREADY);
+ script.append("exit ").append(OsConstants.EALREADY).append(';');
try {
return rootShell.run(null, script.toString()) == OsConstants.EALREADY;
} catch (final ErrnoException | IOException | NoRootException ignored) {
@@ -81,7 +81,7 @@ public final class ToolsInstaller {
new File(nativeLibraryDir, names[0]),
new File(localBinaryDir, names[1])));
}
- script.append("exit ").append(OsConstants.EALREADY);
+ script.append("exit ").append(OsConstants.EALREADY).append(';');
try {
return rootShell.run(null, script.toString()) == OsConstants.EALREADY;
} catch (final ErrnoException | IOException | NoRootException ignored) {
@@ -116,11 +116,11 @@ public final class ToolsInstaller {
public int install() {
if (INSTALL_DIR == null)
return OsConstants.ENOENT;
- final StringBuilder script = new StringBuilder("set -ex"
- + "; trap 'mount -o ro,remount /system' EXIT; mount -o rw,remount /system");
+ final StringBuilder script = new StringBuilder("set -ex;");
+ script.append("trap 'mount -o ro,remount /system' EXIT; mount -o rw,remount /system; ");
for (final String[] names : EXECUTABLES) {
final File destination = new File(INSTALL_DIR, names[1]);
- script.append(String.format("; cp '%s' '%s'; chmod 755 '%s'; restorecon '%s' ",
+ script.append(String.format("cp '%s' '%s'; chmod 755 '%s'; restorecon '%s' || true; ",
new File(nativeLibraryDir, names[0]), destination, destination, destination));
}
try {
@@ -135,9 +135,9 @@ public final class ToolsInstaller {
}
public int symlink() {
- final StringBuilder script = new StringBuilder("set -ex");
+ final StringBuilder script = new StringBuilder("set -ex;");
for (final String[] names : EXECUTABLES) {
- script.append(String.format("; ln -fns '%s' '%s'",
+ script.append(String.format("ln -fns '%s' '%s'; ",
new File(nativeLibraryDir, names[0]),
new File(localBinaryDir, names[1])));
}