Browse Source

ToolsInstaller: Use chcon over restorecon

restorecon probes file_contexts to get the context
to be applied to the file. /sbin/.magisk does not
exist in file_contexts for obvious reasons so restorecon
always fails. Use chcon directly with the system_file
context to allow contexts to be applied.

Suggested-by: Chris Renshaw <osm0sis@outlook.com>
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
master
Harsh Shandilya 5 years ago
committed by Jason A. Donenfeld
parent
commit
69c6fa0a24
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      app/src/main/java/com/wireguard/android/util/ToolsInstaller.java

+ 1
- 1
app/src/main/java/com/wireguard/android/util/ToolsInstaller.java View File

@@ -123,7 +123,7 @@ public final class ToolsInstaller {
script.append("touch /sbin/.core/img/wireguard/auto_mount; ");
for (final String[] names : EXECUTABLES) {
final File destination = new File("/sbin/.core/img/wireguard" + INSTALL_DIR, names[1]);
script.append(String.format("cp '%s' '%s'; chmod 755 '%s'; restorecon '%s' || true; ",
script.append(String.format("cp '%s' '%s'; chmod 755 '%s'; chcon 'u:object_r:system_file:s0' '%s' || true; ",
new File(nativeLibraryDir, names[0]), destination, destination, destination));
}
script.append("trap - INT TERM EXIT;");


Loading…
Cancel
Save