[tor-commits] [ooni-probe/master] Add ability to specify the Tor data directory from the config file

art at torproject.org art at torproject.org
Tue Jan 8 20:11:40 UTC 2013


commit 792d094c400214f738e4ec5c7d91bdb5b440a1a7
Author: Arturo Filastò <art at fuffa.org>
Date:   Tue Jan 8 21:00:31 2013 +0100

    Add ability to specify the Tor data directory from the config file
---
 ooni/runner.py        |    6 ++++++
 ooniprobe.conf.sample |    4 ++++
 2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/ooni/runner.py b/ooni/runner.py
index b9deedc..1a7e629 100644
--- a/ooni/runner.py
+++ b/ooni/runner.py
@@ -528,6 +528,12 @@ def startTor():
         tor_config.SocksPort = socks_port
         config.tor.socks_port = socks_port
 
+    if config.tor.data_dir:
+        if not os.path.exists(config.tor.data_dir):
+            log.msg("%s does not exist. Creating it." % config.tor.data_dir)
+            os.makedirs(config.tor.data_dir)
+        tor_config.DataDirectory = os.path.expanduser(config.tor.data_dir)
+
     tor_config.save()
 
     log.debug("Setting control port as %s" % tor_config.ControlPort)
diff --git a/ooniprobe.conf.sample b/ooniprobe.conf.sample
index ed77dfe..a2f1c5b 100644
--- a/ooniprobe.conf.sample
+++ b/ooniprobe.conf.sample
@@ -35,4 +35,8 @@ tor:
     #control_port: 9051
     # Specify the absolute path to the Tor bridges to use for testing
     bridges: bridges.list
+    # Specify path of the tor datadirectory.
+    # This should be set to something to avoid having Tor download each time
+    # the descriptors and consensus data.
+    data_dir: ~/.tor/
 





More information about the tor-commits mailing list