mirror of
https://github.com/onionshare/onionshare.git
synced 2025-01-15 09:17:25 -05:00
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)
This commit is contained in:
parent
c4ad835322
commit
1bbcd6f5ea
@ -28,9 +28,9 @@ import inspect, os, sys, hashlib, zipfile, io, shutil, subprocess
|
|||||||
import urllib.request
|
import urllib.request
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
dmg_url = 'https://www.torproject.org/dist/torbrowser/6.5.1/TorBrowser-6.5.1-osx64_en-US.dmg'
|
dmg_url = 'https://www.torproject.org/dist/torbrowser/6.5.2/TorBrowser-6.5.2-osx64_en-US.dmg'
|
||||||
dmg_filename = 'TorBrowser-6.5.1-osx64_en-US.dmg'
|
dmg_filename = 'TorBrowser-6.5.2-osx64_en-US.dmg'
|
||||||
expected_dmg_sha256 = '4155633dd51db9c805e8a81a9fd180e7235077f15023b5f002648f1c2a8bef92'
|
expected_dmg_sha256 = '0b11d12f9ff0d82ceb2a9a4dba9c4ba234da47640c8e25e76e4092a7d3a90ef6'
|
||||||
|
|
||||||
# Build paths
|
# Build paths
|
||||||
root_path = os.path.dirname(os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))))
|
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])
|
subprocess.call(['hdiutil', 'attach', dmg_path])
|
||||||
|
|
||||||
# Make sure Resources/tor exists before copying files
|
# Make sure Resources/tor exists before copying files
|
||||||
if os.path.exists(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'))
|
shutil.rmtree(os.path.join(dist_path, 'Resources', 'Tor'))
|
||||||
os.makedirs(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
|
# 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', '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, '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, 'Resources', 'Tor', 'tor'), 0o755)
|
||||||
os.chmod(os.path.join(dist_path, 'MacOS', '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
|
# Unmount dmg
|
||||||
subprocess.call(['diskutil', 'unmount', '/Volumes/Tor Browser'])
|
subprocess.call(['diskutil', 'unmount', '/Volumes/Tor Browser'])
|
||||||
|
@ -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')
|
tor_geo_ipv6_file_path = os.path.join(os.path.join(os.path.join(base_path, 'Data'), 'Tor'), 'geoip6')
|
||||||
elif p == 'Darwin':
|
elif p == 'Darwin':
|
||||||
base_path = os.path.dirname(os.path.dirname(os.path.dirname(get_resource_path(''))))
|
base_path = os.path.dirname(os.path.dirname(os.path.dirname(get_resource_path(''))))
|
||||||
tor_path = os.path.join(base_path, 'MacOS', 'tor')
|
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_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_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)
|
return (tor_path, tor_geo_ip_file_path, tor_geo_ipv6_file_path)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user