From b8d0c00f12cf86c11231ffe2dd576bf9e05f77f1 Mon Sep 17 00:00:00 2001 From: Galileo Sartor Date: Wed, 4 Mar 2020 14:18:50 +0100 Subject: [PATCH 1/3] snap: fix for native-messaging-host permissions add hook for chrome/chromium --- ...-plug-etc-chromium-native-messaging-jabref | 9 ++++ ...lug-etc-opt-chrome-native-messaging-jabref | 9 ++++ ...ug-hostfs-mozilla-native-messaging-jabref} | 2 +- ...-plug-etc-chromium-native-messaging-jabref | 7 +++ ...lug-etc-opt-chrome-native-messaging-jabref | 7 +++ ...ug-hostfs-mozilla-native-messaging-jabref} | 0 snap/snapcraft.yaml | 49 ++++++++++--------- 7 files changed, 58 insertions(+), 25 deletions(-) create mode 100755 snap/hooks/connect-plug-etc-chromium-native-messaging-jabref create mode 100755 snap/hooks/connect-plug-etc-opt-chrome-native-messaging-jabref rename snap/hooks/{connect-plug-browser-extension => connect-plug-hostfs-mozilla-native-messaging-jabref} (61%) create mode 100755 snap/hooks/disconnect-plug-etc-chromium-native-messaging-jabref create mode 100755 snap/hooks/disconnect-plug-etc-opt-chrome-native-messaging-jabref rename snap/hooks/{disconnect-plug-browser-extension => disconnect-plug-hostfs-mozilla-native-messaging-jabref} (100%) diff --git a/snap/hooks/connect-plug-etc-chromium-native-messaging-jabref b/snap/hooks/connect-plug-etc-chromium-native-messaging-jabref new file mode 100755 index 00000000000..47d1fe34522 --- /dev/null +++ b/snap/hooks/connect-plug-etc-chromium-native-messaging-jabref @@ -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 \ No newline at end of file diff --git a/snap/hooks/connect-plug-etc-opt-chrome-native-messaging-jabref b/snap/hooks/connect-plug-etc-opt-chrome-native-messaging-jabref new file mode 100755 index 00000000000..9eefb862aba --- /dev/null +++ b/snap/hooks/connect-plug-etc-opt-chrome-native-messaging-jabref @@ -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 \ No newline at end of file diff --git a/snap/hooks/connect-plug-browser-extension b/snap/hooks/connect-plug-hostfs-mozilla-native-messaging-jabref similarity index 61% rename from snap/hooks/connect-plug-browser-extension rename to snap/hooks/connect-plug-hostfs-mozilla-native-messaging-jabref index df5cde565f3..f6b2d949c04 100755 --- a/snap/hooks/connect-plug-browser-extension +++ b/snap/hooks/connect-plug-hostfs-mozilla-native-messaging-jabref @@ -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 \ No newline at end of file +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 \ No newline at end of file diff --git a/snap/hooks/disconnect-plug-etc-chromium-native-messaging-jabref b/snap/hooks/disconnect-plug-etc-chromium-native-messaging-jabref new file mode 100755 index 00000000000..cca62299ea8 --- /dev/null +++ b/snap/hooks/disconnect-plug-etc-chromium-native-messaging-jabref @@ -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 \ No newline at end of file diff --git a/snap/hooks/disconnect-plug-etc-opt-chrome-native-messaging-jabref b/snap/hooks/disconnect-plug-etc-opt-chrome-native-messaging-jabref new file mode 100755 index 00000000000..77d8422e827 --- /dev/null +++ b/snap/hooks/disconnect-plug-etc-opt-chrome-native-messaging-jabref @@ -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 \ No newline at end of file diff --git a/snap/hooks/disconnect-plug-browser-extension b/snap/hooks/disconnect-plug-hostfs-mozilla-native-messaging-jabref similarity index 100% rename from snap/hooks/disconnect-plug-browser-extension rename to snap/hooks/disconnect-plug-hostfs-mozilla-native-messaging-jabref diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index ccba913feba..3734858e789 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -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 @@ -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: | From 7643e87ee47a217b37781c253f01d704796e7e55 Mon Sep 17 00:00:00 2001 From: Galileo Sartor Date: Wed, 4 Mar 2020 14:48:30 +0100 Subject: [PATCH 2/3] snap: fix no newline --- snap/hooks/connect-plug-etc-chromium-native-messaging-jabref | 2 +- snap/hooks/connect-plug-etc-opt-chrome-native-messaging-jabref | 2 +- snap/hooks/connect-plug-hostfs-mozilla-native-messaging-jabref | 2 +- snap/hooks/disconnect-plug-etc-chromium-native-messaging-jabref | 2 +- .../disconnect-plug-etc-opt-chrome-native-messaging-jabref | 2 +- .../disconnect-plug-hostfs-mozilla-native-messaging-jabref | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/snap/hooks/connect-plug-etc-chromium-native-messaging-jabref b/snap/hooks/connect-plug-etc-chromium-native-messaging-jabref index 47d1fe34522..2644fc7026a 100755 --- a/snap/hooks/connect-plug-etc-chromium-native-messaging-jabref +++ b/snap/hooks/connect-plug-etc-chromium-native-messaging-jabref @@ -6,4 +6,4 @@ if [ ! -d /var/lib/snapd/hostfs/usr/lib/mozilla/native-messaging-hosts ]; then exit 1 fi -cp $SNAP/lib/native-messaging-host/chromium/org.jabref.jabref.json /etc/chromium/native-messaging-hosts/org.jabref.jabref.json \ No newline at end of file +cp "$SNAP/lib/native-messaging-host/chromium/org.jabref.jabref.json" /etc/chromium/native-messaging-hosts/org.jabref.jabref.json diff --git a/snap/hooks/connect-plug-etc-opt-chrome-native-messaging-jabref b/snap/hooks/connect-plug-etc-opt-chrome-native-messaging-jabref index 9eefb862aba..025087770a7 100755 --- a/snap/hooks/connect-plug-etc-opt-chrome-native-messaging-jabref +++ b/snap/hooks/connect-plug-etc-opt-chrome-native-messaging-jabref @@ -6,4 +6,4 @@ if [ ! -d /var/lib/snapd/hostfs/usr/lib/mozilla/native-messaging-hosts ]; then exit 1 fi -cp $SNAP/lib/native-messaging-host/chromium/org.jabref.jabref.json /etc/opt/chrome/native-messaging-hosts/org.jabref.jabref.json \ No newline at end of file +cp "$SNAP/lib/native-messaging-host/chromium/org.jabref.jabref.json" /etc/opt/chrome/native-messaging-hosts/org.jabref.jabref.json diff --git a/snap/hooks/connect-plug-hostfs-mozilla-native-messaging-jabref b/snap/hooks/connect-plug-hostfs-mozilla-native-messaging-jabref index f6b2d949c04..ac597118d7c 100755 --- a/snap/hooks/connect-plug-hostfs-mozilla-native-messaging-jabref +++ b/snap/hooks/connect-plug-hostfs-mozilla-native-messaging-jabref @@ -6,4 +6,4 @@ if [ ! -d /var/lib/snapd/hostfs/usr/lib/mozilla/native-messaging-hosts ]; then exit 1 fi -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 \ No newline at end of file +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 diff --git a/snap/hooks/disconnect-plug-etc-chromium-native-messaging-jabref b/snap/hooks/disconnect-plug-etc-chromium-native-messaging-jabref index cca62299ea8..e68ad21ca73 100755 --- a/snap/hooks/disconnect-plug-etc-chromium-native-messaging-jabref +++ b/snap/hooks/disconnect-plug-etc-chromium-native-messaging-jabref @@ -4,4 +4,4 @@ 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 \ No newline at end of file +fi diff --git a/snap/hooks/disconnect-plug-etc-opt-chrome-native-messaging-jabref b/snap/hooks/disconnect-plug-etc-opt-chrome-native-messaging-jabref index 77d8422e827..50eff0b9292 100755 --- a/snap/hooks/disconnect-plug-etc-opt-chrome-native-messaging-jabref +++ b/snap/hooks/disconnect-plug-etc-opt-chrome-native-messaging-jabref @@ -4,4 +4,4 @@ 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 \ No newline at end of file +fi diff --git a/snap/hooks/disconnect-plug-hostfs-mozilla-native-messaging-jabref b/snap/hooks/disconnect-plug-hostfs-mozilla-native-messaging-jabref index 5af57cf27f9..280d1afc79d 100755 --- a/snap/hooks/disconnect-plug-hostfs-mozilla-native-messaging-jabref +++ b/snap/hooks/disconnect-plug-hostfs-mozilla-native-messaging-jabref @@ -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 \ No newline at end of file +fi From c41fc9ccdb997eea1ef0ee078cd1b0df65060445 Mon Sep 17 00:00:00 2001 From: Galileo Sartor Date: Wed, 4 Mar 2020 14:54:08 +0100 Subject: [PATCH 3/3] Add snap browser integration to changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c0295db7c81..85855ba62a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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)