flatpak/profile/flatpak.sh
Siteshwar Vashisht 4c33b3cec3 profile: fix a shellcheck warning
Error: SHELLCHECK_WARNING (CWE-758): [#def1]
/etc/profile.d/flatpak.sh:1:1: error[SC2148]: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

Resolves: https://openscanhub.fedoraproject.org/task/51962/log/flatpak-1.16.0-3.fc43/scan-results.html#def1

Signed-off-by: Siteshwar Vashisht <svashisht@redhat.com>
2025-05-07 17:54:28 +00:00

30 lines
873 B
Bash

# shellcheck shell=sh
if command -v flatpak > /dev/null; then
# set XDG_DATA_DIRS to include Flatpak installations
new_dirs=$(
(
unset G_MESSAGES_DEBUG
echo "${XDG_DATA_HOME:-"$HOME/.local/share"}/flatpak"
GIO_USE_VFS=local flatpak --installations
) | (
new_dirs=
while read -r install_path
do
share_path=$install_path/exports/share
case ":$XDG_DATA_DIRS:" in
(*":$share_path:"*) :;;
(*":$share_path/:"*) :;;
(*) new_dirs=${new_dirs:+${new_dirs}:}$share_path;;
esac
done
echo "$new_dirs"
)
)
export XDG_DATA_DIRS
XDG_DATA_DIRS="${new_dirs:+${new_dirs}:}${XDG_DATA_DIRS:-/usr/local/share:/usr/share}"
unset new_dirs
fi