aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMicah Lee <micah@micahflee.com>2015-05-15 18:52:20 -0700
committerMicah Lee <micah@micahflee.com>2015-05-15 18:52:20 -0700
commit2ea0c6aef38252bf4a1e4576d3116e6fa1ff88d7 (patch)
treee5130ee623f5fbba98dbf0fae77215647ca466df
parentd6aafd88e7b21f28fadcdda3aef87b5bc9c7aba2 (diff)
downloadonionshare-2ea0c6aef38252bf4a1e4576d3116e6fa1ff88d7.tar.gz
onionshare-2ea0c6aef38252bf4a1e4576d3116e6fa1ff88d7.zip
moving platform-specific scripts into install folder, and making onionshare CLI work in OSX (#132)
-rw-r--r--README.md8
-rwxr-xr-xinstall/linux_scripts/onionshare (renamed from bin/onionshare)0
-rwxr-xr-xinstall/linux_scripts/onionshare-gui (renamed from bin/onionshare-gui)0
-rwxr-xr-xinstall/osx_scripts/onionshare25
-rwxr-xr-xinstall/osx_scripts/onionshare-gui21
-rw-r--r--onionshare/helpers.py8
-rw-r--r--setup.py7
7 files changed, 63 insertions, 6 deletions
diff --git a/README.md b/README.md
index eb22137a..8c0dd45e 100644
--- a/README.md
+++ b/README.md
@@ -33,3 +33,11 @@ Open OnionShare and drag and drop files and folders you wish to share, and start
Send this URL to the person you're trying to send the files to. If the files you're sending aren't secret, you can use normal means of sending the URL: emailing it, posting it to Facebook or Twitter, etc. If you're trying to send secret files then it's important to send this URL securely. I recommend you use [Off-the-Record encrypted chat](https://pressfreedomfoundation.org/encryption-works#otr) to send the URL.
The person who is receiving the files doesn't need OnionShare. All they need is to open the URL you send them in Tor Browser to be able to download the file.
+
+## Using Command Line in Mac OS X
+
+If you'd like to use the command-line version of OnionShare in Mac OS X, after installing open a terminal and type:
+
+`ln -s /Applications/OnionShare.app/Contents/Resources/onionshare /usr/local/bin/onionshare`
+
+From that point on you can just call `onionshare`, like: `onionshare --help`
diff --git a/bin/onionshare b/install/linux_scripts/onionshare
index fadd8bee..fadd8bee 100755
--- a/bin/onionshare
+++ b/install/linux_scripts/onionshare
diff --git a/bin/onionshare-gui b/install/linux_scripts/onionshare-gui
index f0b9955c..f0b9955c 100755
--- a/bin/onionshare-gui
+++ b/install/linux_scripts/onionshare-gui
diff --git a/install/osx_scripts/onionshare b/install/osx_scripts/onionshare
new file mode 100755
index 00000000..db3f6bc9
--- /dev/null
+++ b/install/osx_scripts/onionshare
@@ -0,0 +1,25 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+"""
+OnionShare | https://onionshare.org/
+
+Copyright (C) 2014 Micah Lee <micah@micahflee.com>
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+"""
+import zipimport, os, inspect
+cwd = os.path.dirname(os.path.realpath(os.path.abspath(inspect.getfile(inspect.currentframe()))))
+zi = zipimport.zipimporter(cwd+'/lib/python2.7/site-packages.zip')
+onionshare = zi.load_module('onionshare')
+onionshare.main()
diff --git a/install/osx_scripts/onionshare-gui b/install/osx_scripts/onionshare-gui
new file mode 100755
index 00000000..8725fa68
--- /dev/null
+++ b/install/osx_scripts/onionshare-gui
@@ -0,0 +1,21 @@
+# -*- coding: utf-8 -*-
+"""
+OnionShare | https://onionshare.org/
+
+Copyright (C) 2014 Micah Lee <micah@micahflee.com>
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+"""
+import onionshare_gui
+onionshare_gui.main()
diff --git a/onionshare/helpers.py b/onionshare/helpers.py
index 6465dcfc..c933c97e 100644
--- a/onionshare/helpers.py
+++ b/onionshare/helpers.py
@@ -42,10 +42,12 @@ def get_onionshare_dir():
def get_osx_resources_dir():
- # this is hacky, but in it ultimate ends up returning the absolute path to
- # OnionShare.app/Contents/Resources
- return os.path.dirname(os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))))
+ if get_platform() == 'Darwin':
+ # this is hacky, but in it ultimate ends up returning the absolute path to
+ # OnionShare.app/Contents/Resources, based on the location of helpers.py
+ return os.path.dirname(os.path.dirname(os.path.realpath(os.path.abspath(inspect.getfile(inspect.currentframe())))))
+ return None
def get_html_path(filename):
p = platform.system()
diff --git a/setup.py b/setup.py
index 54eba520..3f796e04 100644
--- a/setup.py
+++ b/setup.py
@@ -83,7 +83,7 @@ if system == 'Linux':
keywords='onion, share, onionshare, tor, anonymous, web server',
packages=['onionshare', 'onionshare_gui'],
include_package_data=True,
- scripts=['bin/onionshare', 'bin/onionshare-gui'],
+ scripts=['install/linux_scripts/onionshare', 'install/linux_scripts/onionshare-gui'],
data_files=[
(os.path.join(sys.prefix, 'share/applications'), ['install/onionshare.desktop']),
(os.path.join(sys.prefix, 'share/pixmaps'), ['install/onionshare80.xpm']),
@@ -98,7 +98,7 @@ elif system == 'Darwin':
version=version,
description=description,
long_description=long_description,
- app=['install/onionshare-launcher.py'],
+ app=['install/osx_scripts/onionshare-gui'],
data_files=[
('images', images),
('locale', locale),
@@ -107,7 +107,8 @@ elif system == 'Darwin':
options={
'py2app': {
'argv_emulation': True,
- 'iconfile':'install/onionshare.icns',
+ 'iconfile': 'install/onionshare.icns',
+ 'extra_scripts': ['install/osx_scripts/onionshare'],
'includes': [
'PyQt4', 'PyQt4.QtCore', 'PyQt4.QtGui',
'jinja2', 'jinja2.ext', 'jinja2.ext.autoescape'],