Skip to content

Commit

Permalink
Switch snapcraft from core20 to core22
Browse files Browse the repository at this point in the history
  • Loading branch information
micahflee committed Sep 6, 2023
1 parent 7b40bf8 commit 0a290a9
Showing 1 changed file with 21 additions and 40 deletions.
61 changes: 21 additions & 40 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: onionshare
base: core20
base: core22
version: "2.6.1"
summary: Securely and anonymously share files, host websites, and chat using Tor
description: |
Expand All @@ -20,8 +20,7 @@ architectures:
apps:
onionshare:
common-id: org.onionshare.OnionShare
command: bin/onionshare-launcher
extensions: [gnome-3-38]
command: bin/onionshare
plugs:
- desktop
- home
Expand All @@ -30,53 +29,28 @@ apps:
- removable-media
environment:
LANG: C.UTF-8
PATH: $SNAP/bin:$SNAP/usr/bin:$SNAP/usr/local/bin:$PATH
LD_LIBRARY_PATH: $LD_LIBRARY_PATH:$SNAP/usr/local/lib

cli:
common-id: org.onionshare.OnionShareCli
command: bin/onionshare-cli-launcher
command: bin/onionshare-cli
plugs:
- home
- network
- network-bind
- removable-media
environment:
LANG: C.UTF-8
PATH: $SNAP/bin:$SNAP/usr/bin:$SNAP/usr/local/bin:$PATH
LD_LIBRARY_PATH: $LD_LIBRARY_PATH:$SNAP/usr/local/lib

parts:
launcher:
plugin: nil
override-build: |
mkdir -p $SNAPCRAFT_PART_INSTALL/bin
cat > $SNAPCRAFT_PART_INSTALL/bin/launcher-setup << EOF
#!/bin/sh
export PATH=\$SNAP/bin:\$SNAP/usr/bin:\$SNAP/usr/local/bin:\$PATH
export PYTHONPATH=\$SNAP/lib/python3.8/site-packages:\$SNAP/usr/lib/python3/dist-packages
export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:\$SNAP/usr/local/lib
ORIG_IFS=\$IFS
IFS=":"
LIB_BASE=\$(for D in \$LD_LIBRARY_PATH; do echo \$D; done | grep \$SNAP/usr/lib/)
IFS=\$ORIGIN_IFS
export QT_PLUGIN_PATH=\$LIB_BASE/qt5/plugins
EOF
cat > $SNAPCRAFT_PART_INSTALL/bin/onionshare-launcher << EOF
#!/bin/sh
. \$SNAP/bin/launcher-setup
onionshare \$@
EOF
cat > $SNAPCRAFT_PART_INSTALL/bin/onionshare-cli-launcher << EOF
#!/bin/sh
. \$SNAP/bin/launcher-setup
onionshare-cli \$@
EOF
chmod 755 $SNAPCRAFT_PART_INSTALL/bin/launcher-setup
chmod 755 $SNAPCRAFT_PART_INSTALL/bin/onionshare-launcher
chmod 755 $SNAPCRAFT_PART_INSTALL/bin/onionshare-cli-launcher
onionshare-cli:
source: ./cli
plugin: nil
override-pull: |
snapcraftctl pull
craftctl default
rm pyproject.toml poetry.lock
after: [tor, obfs4, snowflake-client, meek-client]

Expand Down Expand Up @@ -155,8 +129,15 @@ parts:
- libxslt1.1
- libxtst6
- qtwayland5
- libgstreamer1.0-0
- libgstreamer1.0-dev
- libgstreamer-gl1.0-0
- libgstreamer-plugins-base1.0-0
- libmysqlclient21
- libxcb-cursor0
- libxkbfile1
override-pull: |
snapcraftctl pull
craftctl default
rm pyproject.toml poetry.lock
cat > requirements.txt << EOF
# onionshare_cli
Expand All @@ -183,15 +164,15 @@ parts:
packaging
EOF
override-build: |
python3 -m venv $SNAPCRAFT_PART_INSTALL
. $SNAPCRAFT_PART_INSTALL/bin/activate
python3 -m venv $CRAFT_PART_INSTALL
. $CRAFT_PART_INSTALL/bin/activate
pip install -U pip setuptools wheel
pip install -U -r requirements.txt
pip install -U ../../onionshare-cli/src
pip install -U .
deactivate
sed -i 's|'$SNAPCRAFT_PART_INSTALL'/bin/python3|/usr/bin/env python3|g' $SNAPCRAFT_PART_INSTALL/bin/onionshare
sed -i 's|'$SNAPCRAFT_PART_INSTALL'/bin/python3|/usr/bin/env python3|g' $SNAPCRAFT_PART_INSTALL/bin/onionshare-cli
sed -i 's|'$CRAFT_PART_INSTALL'/bin/python3|/usr/bin/env python3|g' $CRAFT_PART_INSTALL/bin/onionshare
sed -i 's|'$CRAFT_PART_INSTALL'/bin/python3|/usr/bin/env python3|g' $CRAFT_PART_INSTALL/bin/onionshare-cli
after: [onionshare-cli]

tor:
Expand All @@ -200,7 +181,7 @@ parts:
source-type: tar
plugin: autotools
autotools-configure-parameters:
- "--with-libevent-dir=$SNAPCRAFT_PART_INSTALL/../../libevent/install/usr/local"
- "--with-libevent-dir=$CRAFT_PART_INSTALL/../../libevent/install/usr/local"
build-packages:
- libssl-dev
- zlib1g-dev
Expand Down

0 comments on commit 0a290a9

Please sign in to comment.