Skip to content

Add jabfox json file to snap package #5422

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions snap/hooks/connect-plug-browser-extension
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh

if [ ! -d /var/lib/snapd/hostfs/usr/lib/mozilla/native-messaging-hosts ]; then
echo "Missing directory, create it manually then try again:"
echo "sudo mkdir -p /usr/lib/mozilla/native-messaging-hosts"
exit 1
fi

cp $SNAP/lib/org.jabref.jabref.json /var/lib/snapd/hostfs/usr/lib/mozilla/native-messaging-hosts/org.jabref.jabref.json
7 changes: 7 additions & 0 deletions snap/hooks/disconnect-plug-browser-extension
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh

if [ ! -f /var/lib/snapd/hostfs/usr/lib/mozilla/native-messaging-hosts/org.jabref.jabref.json ]; then
exit 0
elif grep --quiet '"path": "/snap' /var/lib/snapd/hostfs/usr/lib/mozilla/native-messaging-hosts/org.jabref.jabref.json; then
rm /var/lib/snapd/hostfs/usr/lib/mozilla/native-messaging-hosts/org.jabref.jabref.json
fi
22 changes: 16 additions & 6 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
name: jabref
# adopt-info: jabref
version: 'master'
version-script: cat build.gradle | grep "^version =" | cut -d'"' -f2
adopt-info: jabref
icon: snap/gui/jabref.png
license: MIT
summary: Bibliography manager
Expand All @@ -14,6 +12,14 @@ license: MIT
architectures:
- build-on: amd64

plugs:
browser-extension:
interface: system-files
read:
- /var/lib/snapd/hostfs/usr/lib/mozilla/native-messaging-hosts
write:
- /var/lib/snapd/hostfs/usr/lib/mozilla/native-messaging-hosts/org.jabref.jabref.json

apps:
jabref:
command: bin/JabRef
Expand All @@ -34,8 +40,12 @@ parts:
jabref:
plugin: dump
source: build/distribution/JabRef-portable_linux.tar.gz
# override-pull: |
# snapcraftctl pull
# snapcraftctl set-version "$(cat app/JabRef.cfg | grep "app.version=" | cut -d'=' -f2)"
# Use this source for debug purposes:
# source: https://builds.jabref.org/master/JabRef-portable_linux.tar.gz
stage-packages:
- x11-utils
override-build: |
snapcraftctl build
snapcraftctl set-version "$(cat $SNAPCRAFT_PART_INSTALL/lib/app/JabRef.cfg | grep "app.version=" | cut -d'=' -f2)"
sed -i 's|/opt/jabref/lib/jabrefHost.py|/snap/jabref/current/lib/jabrefHost.py|g' $SNAPCRAFT_PART_INSTALL/lib/org.jabref.jabref.json