Fix: Setzt xdg Data dirs.

This commit is contained in:
DragonSlayer_14 2025-02-24 13:34:31 +01:00
parent dc4448a98b
commit ea45fb6b26

View File

@ -14,13 +14,37 @@ sudo apt update && sudo apt install -y flatpak neovim
# Flatpak Flathub-Repo hinzufügen
sudo flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
# XDG_DATA_DIRS für Flatpak dauerhaft setzen
XDG_CONFIG_FILE="$HOME/.profile"
XDG_EXPORT="export XDG_DATA_DIRS=\"/var/lib/flatpak/exports/share:$HOME/.local/share/flatpak/exports/share:$XDG_DATA_DIRS\""
if ! grep -Fxq "$XDG_EXPORT" "$XDG_CONFIG_FILE"; then
echo "$XDG_EXPORT" >> "$XDG_CONFIG_FILE"
echo "✅ XDG_DATA_DIRS dauerhaft in .profile gesetzt."
# XDG_DATA_DIRS für Flatpak setzen in /etc/profile.d/flatpak_env.sh
sudo cat << 'EOF' > /etc/profile.d/flatpak.sh
if command -v flatpak > /dev/null; then
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
EOF
sudo chmod +x /etc/profile.d/flatpak_env.sh
# Firefox-Installation
echo "🌍 Firefox wird installiert..."