[Pkg-privacy-commits] [onionshare] 200/256: Update get-tor-osx.py to grab the Tor binary from Tor Browser 6.5.2 instead of 6.5.1, and make it retain the same directory structure in OnionShare as it uses in Tor Browser, including copying libevent-2.0.5.dylib, which was missing before (#385)

Ulrike Uhlig ulrike at moszumanska.debian.org
Fri May 26 12:53:40 UTC 2017


This is an automated email from the git hooks/post-receive script.

ulrike pushed a commit to branch master
in repository onionshare.

commit 1bbcd6f5ea970e3c9fff99a352822a34ae35411b
Author: Micah Lee <micah at micahflee.com>
Date:   Thu May 18 11:22:50 2017 -0700

    Update get-tor-osx.py to grab the Tor binary from Tor Browser 6.5.2 instead of 6.5.1, and make it retain the same directory structure in OnionShare as it uses in Tor Browser, including copying libevent-2.0.5.dylib, which was missing before (#385)
---
 install/get-tor-osx.py | 30 ++++++++++++++++++++----------
 onionshare/common.py   |  6 +++---
 2 files changed, 23 insertions(+), 13 deletions(-)

diff --git a/install/get-tor-osx.py b/install/get-tor-osx.py
index fe43766..a9f68aa 100644
--- a/install/get-tor-osx.py
+++ b/install/get-tor-osx.py
@@ -28,9 +28,9 @@ import inspect, os, sys, hashlib, zipfile, io, shutil, subprocess
 import urllib.request
 
 def main():
-    dmg_url = 'https://www.torproject.org/dist/torbrowser/6.5.1/TorBrowser-6.5.1-osx64_en-US.dmg'
-    dmg_filename = 'TorBrowser-6.5.1-osx64_en-US.dmg'
-    expected_dmg_sha256 = '4155633dd51db9c805e8a81a9fd180e7235077f15023b5f002648f1c2a8bef92'
+    dmg_url = 'https://www.torproject.org/dist/torbrowser/6.5.2/TorBrowser-6.5.2-osx64_en-US.dmg'
+    dmg_filename = 'TorBrowser-6.5.2-osx64_en-US.dmg'
+    expected_dmg_sha256 = '0b11d12f9ff0d82ceb2a9a4dba9c4ba234da47640c8e25e76e4092a7d3a90ef6'
 
     # Build paths
     root_path = os.path.dirname(os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))))
@@ -65,15 +65,25 @@ def main():
     subprocess.call(['hdiutil', 'attach', dmg_path])
 
     # Make sure Resources/tor exists before copying files
-    if os.path.exists(os.path.join(dist_path, 'Resources', 'tor')):
-        shutil.rmtree(os.path.join(dist_path, 'Resources', 'tor'))
-    os.makedirs(os.path.join(dist_path, 'Resources', 'tor'))
+    if os.path.exists(os.path.join(dist_path, 'Resources', 'Tor')):
+        shutil.rmtree(os.path.join(dist_path, 'Resources', 'Tor'))
+    os.makedirs(os.path.join(dist_path, 'Resources', 'Tor'))
+    if os.path.exists(os.path.join(dist_path, 'MacOS', 'Tor')):
+        shutil.rmtree(os.path.join(dist_path, 'MacOS', 'Tor'))
+    os.makedirs(os.path.join(dist_path, 'MacOS', 'Tor'))
+
+    # Modify the tor script to adjust the path
+    tor_script = open(os.path.join(dmg_tor_path, 'Resources', 'TorBrowser', 'Tor', 'tor'), 'r').read()
+    tor_script = tor_script.replace('../../../MacOS/Tor', '../../MacOS/Tor')
+    open(os.path.join(dist_path, 'Resources', 'Tor', 'tor'), 'w').write(tor_script)
 
     # Copy into dist
-    shutil.copyfile(os.path.join(dmg_tor_path, 'Resources', 'TorBrowser', 'Tor', 'geoip'), os.path.join(dist_path, 'Resources', 'tor', 'geoip'))
-    shutil.copyfile(os.path.join(dmg_tor_path, 'Resources', 'TorBrowser', 'Tor', 'geoip6'), os.path.join(dist_path, 'Resources', 'tor', 'geoip6'))
-    shutil.copyfile(os.path.join(dmg_tor_path, 'MacOS', 'Tor', 'tor.real'), os.path.join(dist_path, 'MacOS', 'tor'))
-    os.chmod(os.path.join(dist_path, 'MacOS', 'tor'), 0o755)
+    shutil.copyfile(os.path.join(dmg_tor_path, 'Resources', 'TorBrowser', 'Tor', 'geoip'), os.path.join(dist_path, 'Resources', 'Tor', 'geoip'))
+    shutil.copyfile(os.path.join(dmg_tor_path, 'Resources', 'TorBrowser', 'Tor', 'geoip6'), os.path.join(dist_path, 'Resources', 'Tor', 'geoip6'))
+    os.chmod(os.path.join(dist_path, 'Resources', 'Tor', 'tor'), 0o755)
+    shutil.copyfile(os.path.join(dmg_tor_path, 'MacOS', 'Tor', 'tor.real'), os.path.join(dist_path, 'MacOS', 'Tor', 'tor.real'))
+    shutil.copyfile(os.path.join(dmg_tor_path, 'MacOS', 'Tor', 'libevent-2.0.5.dylib'), os.path.join(dist_path, 'MacOS', 'Tor', 'libevent-2.0.5.dylib'))
+    os.chmod(os.path.join(dist_path, 'MacOS', 'Tor', 'tor.real'), 0o755)
 
     # Unmount dmg
     subprocess.call(['diskutil', 'unmount', '/Volumes/Tor Browser'])
diff --git a/onionshare/common.py b/onionshare/common.py
index 798797d..232328d 100644
--- a/onionshare/common.py
+++ b/onionshare/common.py
@@ -84,9 +84,9 @@ def get_tor_paths():
         tor_geo_ipv6_file_path = os.path.join(os.path.join(os.path.join(base_path, 'Data'), 'Tor'), 'geoip6')
     elif p == 'Darwin':
         base_path = os.path.dirname(os.path.dirname(os.path.dirname(get_resource_path(''))))
-        tor_path               = os.path.join(base_path, 'MacOS', 'tor')
-        tor_geo_ip_file_path   = os.path.join(base_path, 'Resources', 'tor', 'geoip')
-        tor_geo_ipv6_file_path = os.path.join(base_path, 'Resources', 'tor', 'geoip6')
+        tor_path               = os.path.join(base_path, 'Resources', 'Tor', 'tor')
+        tor_geo_ip_file_path   = os.path.join(base_path, 'Resources', 'Tor', 'geoip')
+        tor_geo_ipv6_file_path = os.path.join(base_path, 'Resources', 'Tor', 'geoip6')
 
     return (tor_path, tor_geo_ip_file_path, tor_geo_ipv6_file_path)
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/onionshare.git



More information about the Pkg-privacy-commits mailing list