Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: flatpak-manager exit and retry on failure (ublue-os#583)
Browse files Browse the repository at this point in the history
bobslept authored Oct 13, 2023
1 parent b4cce6b commit 315e932
Showing 4 changed files with 24 additions and 13 deletions.
16 changes: 10 additions & 6 deletions usr/bin/ublue-system-flatpak-manager
Original file line number Diff line number Diff line change
@@ -11,8 +11,6 @@ if [[ -f $VER_FILE && $VER = $VER_RAN ]]; then
exit 0
fi

notify-send "Flatpak installer" "Currently installing system flatpaks" --app-name="Flatpak installer" -u NORMAL

# Remove fedora flatpak repo
if grep -qz 'fedora' <<< $(flatpak remotes); then
flatpak remote-delete --user fedora --force
@@ -27,13 +25,14 @@ REMOVE_LIST=$(cat /etc/flatpak/system/remove)
if [[ -n $INSTALL_LIST ]]; then
for flatpak in $INSTALL_LIST; do
if grep -qvz $flatpak <<< $FLATPAK_LIST; then
flatpak install --system --noninteractive flathub $flatpak
if ! flatpak install --system --noninteractive flathub $flatpak; then
# exit on error
exit 1
fi
fi
done
fi

notify-send "Flatpak installer" "Finished installing system flatpaks" --app-name="Flatpak installer" -u NORMAL

# Remove flatpaks in list
if [[ -n $REMOVE_LIST ]]; then
for flatpak in $REMOVE_LIST; do
@@ -51,12 +50,17 @@ if grep -qz 'fedora' <<< $(flatpak remotes); then

FEDORA_FLATPAKS=$(flatpak list --columns=application,origin | grep -w 'fedora' | awk '{print $1}')
for flatpak in $FEDORA_FLATPAKS; do
flatpak remove --system --noninteractive $flatpak
if ! flatpak remove --system --noninteractive $flatpak; then
# exit on error
exit 1
fi
done
fi

# Disable the system variant of the flathub repo
flatpak remote-modify flathub --disable --system

notify-send "Flatpak installer" "Finished installing system flatpaks" --app-name="Flatpak installer" -u NORMAL

mkdir -p /etc/ublue
echo $VER > $VER_FILE
17 changes: 10 additions & 7 deletions usr/bin/ublue-user-flatpak-manager
Original file line number Diff line number Diff line change
@@ -19,27 +19,30 @@ FLATPAK_LIST=$(flatpak list --columns=application)
INSTALL_LIST=$(cat /etc/flatpak/user/install)
REMOVE_LIST=$(cat /etc/flatpak/user/remove)

notify-send "Flatpak installer" "Currently installing user flatpaks" --app-name="Flatpak installer" -u NORMAL

# 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 $flatpak
if ! flatpak install --user --noninteractive flathub $flatpak; then
# exit on error
exit 1
fi
fi
done
fi

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


# 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
if ! flatpak remove --user --noninteractive $flatpak; then
# exit on error
exit 1
fi
fi
done
fi

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

echo $VER > $VER_FILE
2 changes: 2 additions & 0 deletions usr/lib/systemd/system/ublue-system-flatpak-manager.service
Original file line number Diff line number Diff line change
@@ -8,6 +8,8 @@ After=network-online.target ublue-system-setup.service
Type=oneshot
ExecStart=/usr/bin/ublue-system-flatpak-manager
Restart=on-failure
RestartSec=30
StartLimitInterval=0

[Install]
WantedBy=multi-user.target
2 changes: 2 additions & 0 deletions usr/lib/systemd/user/ublue-user-flatpak-manager.service
Original file line number Diff line number Diff line change
@@ -8,6 +8,8 @@ After=network-online.target
Type=oneshot
ExecStart=/usr/bin/ublue-user-flatpak-manager
Restart=on-failure
RestartSec=30
StartLimitInterval=0

[Install]
WantedBy=default.target

0 comments on commit 315e932

Please sign in to comment.