diff --git a/.gitignore b/.gitignore index 3c8d103d..e58af6a0 100644 --- a/.gitignore +++ b/.gitignore @@ -21,6 +21,7 @@ develop-eggs MANIFEST env onionshare-*.tar.gz +onionshare_*.snap # Installer logs pip-log.txt diff --git a/desktop/README.md b/desktop/README.md index cf3c4113..7d816b16 100644 --- a/desktop/README.md +++ b/desktop/README.md @@ -95,6 +95,40 @@ xvfb-run ./tests/run.sh ## Making a release +### Flatpak packaging + +See: https://github.com/micahflee/org.onionshare.OnionShare + +### Snapcraft packaging + +This folder contains files to build a [snap package](https://snapcraft.io/). First make sure you install `snap` and `snapcraft` (`snap install snapcraft --classic`). + +To build the snap, cd to the `onionshare` folder and run: + +```sh +snapcraft +snap install --devmode ./onionshare_*.snap +``` + +See your installed snaps: + +```sh +snap list +``` + +Run the OnionShare snap: + +```sh +/snap/bin/onionshare # CLI version +/snap/bin/onionshare.onionshare-gui # GUI version +``` + +Delete the OnionShare snap: + +```sh +snap remove onionshare +``` + ### Linux Build a wheel package for OnionShare CLI: diff --git a/desktop/install/scripts/onionshare b/desktop/install/scripts/onionshare deleted file mode 100755 index 67298b6f..00000000 --- a/desktop/install/scripts/onionshare +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -""" -OnionShare | https://onionshare.org/ - -Copyright (C) 2014-2020 Micah Lee, et al. - -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 . -""" -import onionshare - -onionshare.main() diff --git a/desktop/install/scripts/onionshare-gui b/desktop/install/scripts/onionshare-gui deleted file mode 100755 index f1d36a86..00000000 --- a/desktop/install/scripts/onionshare-gui +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -""" -OnionShare | https://onionshare.org/ - -Copyright (C) 2014-2020 Micah Lee, et al. - -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 . -""" -import onionshare_gui - -onionshare_gui.main() diff --git a/desktop/install/scripts/onionshare-pyinstaller b/desktop/install/scripts/onionshare-pyinstaller deleted file mode 100644 index 8ca791aa..00000000 --- a/desktop/install/scripts/onionshare-pyinstaller +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -""" -OnionShare | https://onionshare.org/ - -Copyright (C) 2014-2020 Micah Lee, et al. - -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 . -""" -import sys, os, platform - -# In macOS, allow both CLI and GUI depending on the filename of the binary -# being executed -if platform.system() == "Darwin": - # If the binary being executed is called 'onionshare', use CLI - basename = os.path.basename(sys.argv[0]) - if basename == "onionshare": - import onionshare - - onionshare.main() - - # Otherwise, use GUI - else: - import onionshare_gui - - onionshare_gui.main() - -# Unfortunately this trick won't work in Windows because I want to set -# console=False in the PyInstaller spec file, so there isn't a command prompt -# open in the background every you run the GUI. Hopefully Windows can get -# a built-in CLI when PyInstaller 3.3 comes out: -# https://pyinstaller.readthedocs.io/en/stable/spec-files.html#multipackage-bundles -else: - import onionshare_gui - - onionshare_gui.main() diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml new file mode 100644 index 00000000..f42a1f28 --- /dev/null +++ b/snap/snapcraft.yaml @@ -0,0 +1,133 @@ +name: onionshare +base: core18 +version: '2.2' +summary: Securely and anonymously send and receive files, and publish onion sites +description: | + OnionShare is an open source tool for securely and anonymously sending and + receiving files and publishing websites using Tor onion services. It works by + starting a web server directly on your computer and making it accessible as + an unguessable Tor web address that others can load in Tor Browser. It + doesn't require setting up a separate server, using a third party service, or + even logging into an account. + +grade: devel # must be 'stable' to release into candidate/stable channels +confinement: devmode # use 'strict' once you have the right plugs and slots + +apps: + onionshare-gui: + common-id: org.onionshare.OnionShareGui + command: onionshare-gui + plugs: + - desktop + - home + - network + - network-bind + - removable-media + + onionshare: + common-id: org.onionshare.OnionShare + command: onionshare + plugs: + - home + - network + - network-bind + - removable-media + +parts: + onionshare: + source: . + plugin: python + python-version: python3 + python-packages: + - poetry + stage-packages: + - libatk-bridge2.0-0 + - libatspi2.0-0 + - libgtk-3-0 + after: [qt5, tor, obfs4] + + # Install Qt5 pre-compiled binary, because it's much simpler than + # building from source + qt5: + plugin: nil + override-pull: | + wget https://download.qt.io/official_releases/qt/5.14/5.14.0/qt-opensource-linux-x64-5.14.0.run + echo "4379f147c6793ec7e7349d2f9ee7d53b8ab6ea4e4edf8ee0574a75586a6a6e0e *qt-opensource-linux-x64-5.14.0.run" | shasum -a 256 --check + chmod +x qt-opensource-linux-x64-5.14.0.run + build-packages: + - xvfb + - libdbus-1-3 + - libxkbcommon-x11-0 + - libxkbcommon-x11-dev + - libfontconfig1 + override-build: | + # qt-installer-script.js + echo "function Controller(){installer.installationFinished.connect(proceed)}function logCurrentPage(){var pageName=page().objectName;var pagePrettyTitle=page().title;console.log('At page: '+pageName+' ('+pagePrettyTitle+')')}function page(){return gui.currentPageWidget()}function proceed(button,delay){gui.clickButton(button||buttons.NextButton,delay)}Controller.prototype.WelcomePageCallback=function(){logCurrentPage();proceed(buttons.NextButton,2000)};Controller.prototype.CredentialsPageCallback=function(){logCurrentPage();proceed()};Controller.prototype.IntroductionPageCallback=function(){logCurrentPage();proceed()};Controller.prototype.TargetDirectoryPageCallback=function(){logCurrentPage();var dir=installer.environmentVariable('SNAPCRAFT_PART_INSTALL')+'/opt/Qt5.14.0';console.log('Installing to '+dir);page().TargetDirectoryLineEdit.setText(dir);proceed()};Controller.prototype.ComponentSelectionPageCallback=function(){logCurrentPage();page().deselectAll();page().selectComponent('qt.qt5.5140.gcc_64');proceed()};Controller.prototype.LicenseAgreementPageCallback=function(){logCurrentPage();page().AcceptLicenseRadioButton.checked=true;gui.clickButton(buttons.NextButton)};Controller.prototype.ReadyForInstallationPageCallback=function(){logCurrentPage();proceed()};Controller.prototype.PerformInstallationPageCallback=function(){logCurrentPage()};Controller.prototype.FinishedPageCallback=function(){logCurrentPage();proceed(buttons.FinishButton)};Controller.prototype.DynamicTelemetryPluginFormCallback=function(){logCurrentPage();console.log(Object.keys(page().TelemetryPluginForm.statisticGroupBox));var radioButtons=page().TelemetryPluginForm.statisticGroupBox;radioButtons.disableStatisticRadioButton.checked=true;proceed()};" > qt-installer-script.js + # Disable Qt installer from phoning home via hosts file + echo "127.0.0.1 iapi.qt.io.herokudns.com" >> /etc/hosts + # Install Qt5 + rm -rf $SNAPCRAFT_PART_INSTALL/opt/Qt5.14.0 + xvfb-run ./qt-opensource-linux-x64-5.14.0.run --script qt-installer-script.js --verbose + stage-packages: + - libdrm2 + - libfontconfig1 + - libfreetype6 + - libgl1 + - libglvnd0 + - libglx0 + - libpng16-16 + - libx11-6 + - libx11-xcb1 + - libxau6 + - libxcb-glx0 + - libxcb-xkb1 + - libxcb1 + - libxdmcp6 + - libxext6 + - libxkbcommon-x11-0 + - libxkbcommon0 + - libegl1 + - libasound2 + - libbluetooth3 + - libcairo-gobject2 + - libcairo2 + - libcups2 + - libgdk-pixbuf2.0-0 + - libgtk3.0-cil + - libgstreamer-plugins-base1.0-0 + - libodbc1 + - libpango-1.0-0 + - libpangocairo-1.0-0 + - libpq5 + - libpulse-mainloop-glib0 + - libpulse0 + - libspeechd2 + - libwayland-client0 + - libwayland-cursor0 + - libwayland-egl1 + - libxml2 + - libqt5webengine5 + - libqt5webenginecore5 + + tor: + source: https://dist.torproject.org/tor-0.4.2.7.tar.gz + source-checksum: sha256/06a1d835ddf382f6bca40a62e8fb40b71b2f73d56f0d53523c8bd5caf9b3026d + source-type: tar + plugin: autotools + build-packages: + - libssl-dev + - zlib1g-dev + after: [libevent] + + libevent: + source: https://github.com/libevent/libevent/releases/download/release-2.1.11-stable/libevent-2.1.11-stable.tar.gz + source-checksum: sha256/a65bac6202ea8c5609fd5c7e480e6d25de467ea1917c08290c521752f147283d + source-type: tar + plugin: autotools + + obfs4: + source: pass + plugin: go + go-importpath: gitlab.com/yawning/obfs4 + source: https://gitlab.com/yawning/obfs4 + source-type: git