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 1 commit
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-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
LyzardKing marked this conversation as resolved.
Show resolved Hide resolved
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
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