Skip to content
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

snap: fix for native-messaging-host permissions #6062

Merged
merged 3 commits into from
Mar 4, 2020
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#

### Changed

- Added browser integration to the snap package for firefox/chromium browsers. [#6062](https://github.com/JabRef/jabref/pull/6062)
- We reintroduced the possibility to extract references from plain text (using [GROBID](https://grobid.readthedocs.io/en/latest/)). [#5614](https://github.com/JabRef/jabref/pull/5614)
- We changed the open office panel to show buttons in rows of three instead of going straight down to save space as the button expanded out to take up unnecessary horizontal space. [#5479](https://github.com/JabRef/jabref/issues/5479)
- We cleaned up the group add/edit dialog. [#5826](https://github.com/JabRef/jabref/pull/5826)
Expand Down
9 changes: 9 additions & 0 deletions snap/hooks/connect-plug-etc-chromium-native-messaging-jabref
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 /etc/chromium/native-messaging-hosts"
exit 1
fi

cp "$SNAP/lib/native-messaging-host/chromium/org.jabref.jabref.json" /etc/chromium/native-messaging-hosts/org.jabref.jabref.json
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 /etc/opt/chrome/native-messaging-hosts"
exit 1
fi

cp "$SNAP/lib/native-messaging-host/chromium/org.jabref.jabref.json" /etc/opt/chrome/native-messaging-hosts/org.jabref.jabref.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ if [ ! -d /var/lib/snapd/hostfs/usr/lib/mozilla/native-messaging-hosts ]; then
exit 1
fi

cp $SNAP/lib/org.jabref.jabref.json /var/lib/snapd/hostfs/usr/lib/mozilla/native-messaging-hosts/org.jabref.jabref.json
cp "$SNAP/lib/native-messaging-host/firefox/org.jabref.jabref.json" /var/lib/snapd/hostfs/usr/lib/mozilla/native-messaging-hosts/org.jabref.jabref.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh

if [ ! -f /etc/chromium/native-messaging-hosts/org.jabref.jabref.json ]; then
exit 0
elif grep --quiet '"path": "/snap' /etc/chromium/native-messaging-hosts/org.jabref.jabref.json; then
rm /etc/chromium/native-messaging-hosts/org.jabref.jabref.json
fi
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh

if [ ! -f /etc/opt/chrome/native-messaging-hosts/org.jabref.jabref.json ]; then
exit 0
elif grep --quiet '"path": "/snap' /etc/opt/chrome/native-messaging-hosts/org.jabref.jabref.json; then
rm /etc/opt/chrome/native-messaging-hosts/org.jabref.jabref.json
fi
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ if [ ! -f /var/lib/snapd/hostfs/usr/lib/mozilla/native-messaging-hosts/org.jabre
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
fi
49 changes: 25 additions & 24 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,28 @@ license: MIT
architectures:
- build-on: amd64

plugs:
desktop:
desktop-legacy:
wayland:
unity7:
home:
opengl:
network-bind:
removable-media:
hostfs-mozilla-native-messaging-jabref:
interface: system-files
write:
- /var/lib/snapd/hostfs/usr/lib/mozilla/native-messaging-hosts/org.jabref.jabref.json
etc-opt-chrome-native-messaging-jabref:
interface: system-files
write:
- /etc/opt/chrome/native-messaging-hosts/org.jabref.jabref.json
etc-chromium-native-messaging-jabref:
interface: system-files
write:
- /etc/chromium/native-messaging-hosts/org.jabref.jabref.json

apps:
jabref:
command: bin/JabRef
Expand All @@ -22,34 +44,13 @@ apps:

environment:
_JAVA_OPTIONS: "-Duser.home=$SNAP_USER_DATA"
plugs:
desktop:
desktop-legacy:
wayland:
unity7:
home:
opengl:
network-bind:
removable-media:
plugs:
hostfs-mozilla-native-messaging-jabref:
interface: system-files
write:
- /var/lib/snapd/hostfs/usr/lib/mozilla/native-messaging-hosts/org.jabref.jabref.json
hostfs-chrome-native-messaging-jabref:
interface: system-files
write:
- /var/lib/snapd/hostfs/etc/opt/chrome/native-messaging-hosts/org.jabref.jabref.json
hostfs-chromium-native-messaging-jabref:
interface: system-files
write:
- /var/lib/snapd/hostfs/etc/chromium/native-messaging-hosts/org.jabref.jabref.json

parts:
jabref:
plugin: dump
source: build/distribution/JabRef-portable_linux.tar.gz
# source: build/distribution/JabRef-5.0-portable_linux.tar.gz
# Use this source for debug purposes:
# source: https://builds.jabref.org/master/JabRef-portable_linux.tar.gz
source: https://builds.jabref.org/master/JabRef-5.0-portable_linux.tar.gz
stage-packages:
- x11-utils
override-build: |
Expand Down