Skip to content

Commit

Permalink
feat: Enable flatpak installation and removal for user
Browse files Browse the repository at this point in the history
  • Loading branch information
zelikos committed Oct 1, 2023
1 parent 178f727 commit 631e335
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions config/files/usr/bin/user-flatpak-setup
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,29 @@ if grep -qz 'fedora' <<< $(flatpak remotes); then
fi
flatpak remote-add --if-not-exists --user flathub-user https://flathub.org/repo/flathub.flatpakrepo

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

# Install flatpaks in list
if [[ -n $INSTALL_LIST ]]; then
for flatpak in $INSTALL_LIST; do
if grep -qvz $flatpak <<< $FLATPAK_LIST; then
flatpak install --user --noninteractive flathub-user $flatpak
fi
done
fi

# Remove flatpaks in list
if [[ -n $REMOVE_LIST ]]; then
for flatpak in $REMOVE_LIST; do
if grep -qz $flatpak <<< $FLATPAK_LIST; then
flatpak remove --user --noninteractive $flatpak
fi
done
fi

# Prevent future executions
echo "Writing state file"
mkdir -p $HOME/.config/ublue-os/
Expand Down

0 comments on commit 631e335

Please sign in to comment.