1
0
Fork 0

flatpak-manage.sh: improve detection of flatpak bin

When running this script from a NixOS systemd service, the PATH is
"isolated". And adding the path of the flatpak package to PATH would
likely just install the flatpak package too. Which is not intentional
for non-desktop systems. So, use this hack or whatever.
This commit is contained in:
Pratham Patel 2024-01-20 17:25:09 +05:30
parent ff3d3e608a
commit 1297284712
Signed by: thefossguy
SSH Key Fingerprint: SHA256:/B3wAg7jnMEBQ2JwkebbS/eXVZANDmqRfnd9QkIhxMI
1 changed files with 9 additions and 5 deletions

View File

@ -37,12 +37,16 @@ else
fi
if command -v flatpak > /dev/null; then
flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
flatpak install --user --or-update --assumeyes --noninteractive "${ALL_PKGS[@]}"
flatpak update --user --assumeyes --noninteractive
flatpak uninstall --user --unused --assumeyes --noninteractive --delete-data
flatpak repair --user
FLATPAK_BIN="$(command -v flatpak)"
elif [[ -x '/run/current-system/sw/bin/flatpak' ]]; then
FLATPAK_BIN='/run/current-system/sw/bin/flatpak'
else
echo 'Flatpak not found, exiting cleanly nonetheless'
exit 0
fi
${FLATPAK_BIN} remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
${FLATPAK_BIN} install --user --or-update --assumeyes --noninteractive "${ALL_PKGS[@]}"
${FLATPAK_BIN} update --user --assumeyes --noninteractive
${FLATPAK_BIN} uninstall --user --unused --assumeyes --noninteractive --delete-data
${FLATPAK_BIN} repair --user