From 9ef5d3df20025b443efc01ed49bab7c60f4d6f26 Mon Sep 17 00:00:00 2001
From: Nico Alt <nicoalt@posteo.org>
Date: Sun, 10 Jan 2021 12:00:00 +0000
Subject: [PATCH] Don't install Briar's own Tor binary

Instead users can provide their own binary in ~/.briar/tor:
```
sudo apt install tor tor-geoipdb obfs4proxy
cp /usr/bin/tor         ~/.briar/tor/tor
cp /usr/bin/obfs4proxy  ~/.briar/tor/obfs4proxy
cp /usr/share/tor/geoip ~/.briar/tor/geoip
```

The file ~/.briar/tor/torrc should contain:
```
ControlPort 59051
CookieAuthentication 1
DisableNetwork 1
RunAsDaemon 1
SafeSocks 1
SocksPort 59050
```

You can apply this patch with
```
git am < briar-ship-no-tor-binary.patch
```

Based on https://code.briarproject.org/briar/briar-gtk/-/issues/49
and
http://4g375hpowkjyopwa7c5lm7f4ovzhceezvscm342uklflfpl3mcxxhxyd.onion/briar_headless_on_librem5_devkit.html
---
 .../briarproject/bramble/plugin/tor/TorPlugin.java |  2 --
 .../bramble/plugin/tor/UnixTorPluginFactory.java   | 14 +-------------
 2 files changed, 1 insertion(+), 15 deletions(-)

diff --git a/bramble-core/src/main/java/org/briarproject/bramble/plugin/tor/TorPlugin.java b/bramble-core/src/main/java/org/briarproject/bramble/plugin/tor/TorPlugin.java
index 17bb73c79..3a9bb7c87 100644
--- a/bramble-core/src/main/java/org/briarproject/bramble/plugin/tor/TorPlugin.java
+++ b/bramble-core/src/main/java/org/briarproject/bramble/plugin/tor/TorPlugin.java
@@ -224,8 +224,6 @@ abstract class TorPlugin implements DuplexPlugin, EventHandler, EventListener {
 		}
 		// Load the settings
 		settings = migrateSettings(callback.getSettings());
-		// Install or update the assets if necessary
-		if (!assetsAreUpToDate()) installAssets();
 		if (cookieFile.exists() && !cookieFile.delete())
 			LOG.warning("Old auth cookie not deleted");
 		// Start a new Tor process
diff --git a/bramble-java/src/main/java/org/briarproject/bramble/plugin/tor/UnixTorPluginFactory.java b/bramble-java/src/main/java/org/briarproject/bramble/plugin/tor/UnixTorPluginFactory.java
index 35fe3cc90..f5cb82b3d 100644
--- a/bramble-java/src/main/java/org/briarproject/bramble/plugin/tor/UnixTorPluginFactory.java
+++ b/bramble-java/src/main/java/org/briarproject/bramble/plugin/tor/UnixTorPluginFactory.java
@@ -92,19 +92,7 @@ public class UnixTorPluginFactory implements DuplexPluginFactory {
 
 	@Override
 	public DuplexPlugin createPlugin(PluginCallback callback) {
-		// Check that we have a Tor binary for this architecture
-		String architecture = null;
-		if (isLinux()) {
-			String arch = System.getProperty("os.arch");
-			if (arch.equals("amd64")) {
-				architecture = "linux-x86_64";
-			}
-		}
-		if (architecture == null) {
-			LOG.info("Tor is not supported on this architecture");
-			return null;
-		}
-
+		String architecture = "linux";
 		Backoff backoff = backoffFactory.createBackoff(MIN_POLLING_INTERVAL,
 				MAX_POLLING_INTERVAL, BACKOFF_BASE);
 		TorRendezvousCrypto torRendezvousCrypto = new TorRendezvousCryptoImpl();
-- 
2.29.2

