diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 377d2652..3ff5631e 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -47,20 +47,30 @@ parts: 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 + ORIG_IFS=\$IFS + LD_BASE=\$(for D in \$LD_LIBRARY_PATH; do echo \$D; done | grep \$SNAP/usr/lib/) + IFS=\$ORIGIN_IFS + export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:\$SNAP/usr/local/lib:\$LD_BASE/qt5/plugins/imageformats:\$LD_BASE/qt5/plugins/platforms:\$LD_BASE/qt5/plugins/wayland-shell-integration + EOF + cat > $SNAPCRAFT_PART_INSTALL/bin/onionshare-launcher << EOF #!/bin/sh - export PATH=\$SNAP/bin:\$SNAP/usr/bin:\$SNAP/usr/local/bin:\$PATH - export PYTHONPATH=\$SNAP/lib/python3.8/site-packages - export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:\$SNAP/usr/local/lib + launcher-setup onionshare \$@ EOF + cat > $SNAPCRAFT_PART_INSTALL/bin/onionshare-cli-launcher << EOF #!/bin/sh - export PATH=\$SNAP/bin:\$SNAP/usr/bin:\$SNAP/usr/local/bin:\$PATH - export PYTHONPATH=\$SNAP/lib/python3.8/site-packages - export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:\$SNAP/usr/local/lib + 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: