flathub / org.zotero.Zotero

https://flathub.org/apps/details/org.zotero.Zotero
21 stars 16 forks source link

Feature request: Support for git-sync with better-biblatex #92

Open pbsds opened 2 years ago

pbsds commented 2 years ago

In short: the better-biblatex plugin looks for git in PATH, and uses it to push auto-exported files to the default remote. (Feature documented here)

Problem: It doesn't work with Zotero from flathub, and my guess it that git most likely isn't available in the virtual environment.

Solutions would most likely be to either include a copy of git, or somehow let Zotero access the system-wide git.

felipehw commented 2 years ago

Maybe this help you: #89 .

@qoheniac found a way to let Zotero access the system-wide binaries ...

qoheniac commented 2 years ago

Just write git wherever I wrote texstudio and it should work, i. e.

BINPATH="$HOME/.zotero-bin"  # Should not be included in host's $PATH
mkdir -p "$BINPATH"
echo -e '#!/usr/bin/env sh\nflatpak-spawn --host git "$@"' > "$BINPATH/git"
chmod +x "$BINPATH/git"
flatpak override --user --talk-name=org.freedesktop.Flatpak --filesystem="$BINPATH" --env=PATH="$BINPATH:/app/bin:/usr/bin" org.zotero.Zotero

or if you want to use texstudio as well as git you could do

BINPATH="$HOME/.zotero-bin"  # Should not be included in host's $PATH
mkdir -p "$BINPATH"
echo -e '#!/usr/bin/env sh\nflatpak-spawn --host git "$@"' > "$BINPATH/git"
chmod +x "$BINPATH/git"
echo -e '#!/usr/bin/env sh\nflatpak-spawn --host texstudio "$@"' > "$BINPATH/texstudio"
chmod +x "$BINPATH/texstudio"
flatpak override --user --talk-name=org.freedesktop.Flatpak --filesystem="$BINPATH" --env=PATH="$BINPATH:/app/bin:/usr/bin" org.zotero.Zotero

The --talk-name part allows Zotero to run things unsandboxed, i. e. do flatpak-spawn --host, the --filesystem part gives Zotero access to the folder with the spawn scripts and the --env part adds that folder to the PATH environment variable inside the sandbox so Zotero can find git and/or texstudio there. It is important that the folder with the spawn scripts is not part of your host system's PATH environment variable so that your host system can still find the actual binaries ($HOME/.zotero-bin should be save).

Altonss commented 2 years ago

Wouldn't it be possible to ship git directly with the flatpak?