Skip to content

Commit

Permalink
fix: Port over a fix for flatpaks failing to install from Bazzite (#730)
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleGospo authored Dec 15, 2023
1 parent 94bb013 commit 846af93
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 16 deletions.
23 changes: 15 additions & 8 deletions usr/bin/ublue-system-flatpak-manager
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,27 @@ fi

# Lists of flatpaks
FLATPAK_LIST=$(flatpak list --columns=application)
INSTALL_LIST=$(cat /etc/flatpak/system/install)
REMOVE_LIST=$(cat /etc/flatpak/system/remove)
INSTALL_LIST_FILE="/etc/flatpak/system/install"
REMOVE_LIST_FILE="/etc/flatpak/system/remove"


# Install flatpaks in list
if [[ -n $INSTALL_LIST ]]; then
if ! flatpak install --system --noninteractive flathub ${INSTALL_LIST[@]}; then
# exit on error
exit 1
if [[ -f $INSTALL_LIST_FILE ]]; then
INSTALL_LIST=$(echo $FLATPAK_LIST | grep -vf - $INSTALL_LIST_FILE)
if [[ -n $INSTALL_LIST ]]; then
if ! flatpak install --system --noninteractive flathub ${INSTALL_LIST[@]}; then
# exit on error
exit 1
fi
fi
fi

# Remove flatpaks in list
if [[ -n $REMOVE_LIST ]]; then
flatpak remove --system --noninteractive ${REMOVE_LIST[@]}
if [[ -f $REMOVE_LIST_FILE ]]; then
REMOVE_LIST=$(echo $FLATPAK_LIST | grep -f - $REMOVE_LIST_FILE)
if [[ -n $REMOVE_LIST ]]; then
flatpak remove --system --noninteractive ${REMOVE_LIST[@]}
fi
fi

# Opt out of and remove Fedora's flatpak repo
Expand Down
22 changes: 14 additions & 8 deletions usr/bin/ublue-user-flatpak-manager
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,26 @@ flatpak remote-add --if-not-exists --user flathub /etc/flatpak/remotes.d/flathub

# Lists of flatpaks
FLATPAK_LIST=$(flatpak list --columns=application)
INSTALL_LIST=$(cat /etc/flatpak/user/install)
REMOVE_LIST=$(cat /etc/flatpak/user/remove)
INSTALL_LIST_FILE="/etc/flatpak/user/install"
REMOVE_LIST_FILE="/etc/flatpak/user/remove"

# Install flatpaks in list
if [[ -n $INSTALL_LIST ]]; then
if ! flatpak install --user --noninteractive flathub ${INSTALL_LIST[@]}; then
# exit on error
exit 1
if [[ -f $INSTALL_LIST_FILE ]]; then
INSTALL_LIST=$(echo $FLATPAK_LIST | grep -vf - $INSTALL_LIST_FILE)
if [[ -n $INSTALL_LIST ]]; then
if ! flatpak install --user --noninteractive flathub ${INSTALL_LIST[@]}; then
# exit on error
exit 1
fi
fi
fi

# Remove flatpaks in list
if [[ -n $REMOVE_LIST ]]; then
flatpak remove --user --noninteractive ${REMOVE_LIST[@]}
if [[ -f $REMOVE_LIST_FILE ]]; then
REMOVE_LIST=$(echo $FLATPAK_LIST | grep -f - $REMOVE_LIST_FILE)
if [[ -n $REMOVE_LIST ]]; then
flatpak remove --user --noninteractive ${REMOVE_LIST[@]}
fi
fi

notify-send "Flatpak installer" "Finished installing user flatpaks" --app-name="Flatpak installer" -u NORMAL
Expand Down

0 comments on commit 846af93

Please sign in to comment.