From a4df1530a0ea31289828c4c612474c8d72b3e411 Mon Sep 17 00:00:00 2001 From: bobslept <38557801+bobslept@users.noreply.github.com> Date: Thu, 12 Oct 2023 23:45:50 +0200 Subject: [PATCH 1/3] fix: flatpak-user-manager exit on failure --- usr/bin/ublue-user-flatpak-manager | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/usr/bin/ublue-user-flatpak-manager b/usr/bin/ublue-user-flatpak-manager index 95d9b5eacd8..f8f4530d93c 100755 --- a/usr/bin/ublue-user-flatpak-manager +++ b/usr/bin/ublue-user-flatpak-manager @@ -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 From 9d9633dbb45bfb0b8ba9ce9730ab1afc4a1db7a2 Mon Sep 17 00:00:00 2001 From: bobslept <38557801+bobslept@users.noreply.github.com> Date: Fri, 13 Oct 2023 00:00:31 +0200 Subject: [PATCH 2/3] fix: increase restart count on failure --- usr/lib/systemd/user/ublue-user-flatpak-manager.service | 2 ++ 1 file changed, 2 insertions(+) diff --git a/usr/lib/systemd/user/ublue-user-flatpak-manager.service b/usr/lib/systemd/user/ublue-user-flatpak-manager.service index 1398e805ca0..f900fbca9e6 100644 --- a/usr/lib/systemd/user/ublue-user-flatpak-manager.service +++ b/usr/lib/systemd/user/ublue-user-flatpak-manager.service @@ -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 From fc46402f00ec968313171b6342407a0a17df664a Mon Sep 17 00:00:00 2001 From: bobslept <38557801+bobslept@users.noreply.github.com> Date: Fri, 13 Oct 2023 00:21:10 +0200 Subject: [PATCH 3/3] fix: add changes to flatpak-system-manager --- usr/bin/ublue-system-flatpak-manager | 16 ++++++++++------ .../system/ublue-system-flatpak-manager.service | 2 ++ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/usr/bin/ublue-system-flatpak-manager b/usr/bin/ublue-system-flatpak-manager index a503caaa8ee..0f4e1e09dd2 100755 --- a/usr/bin/ublue-system-flatpak-manager +++ b/usr/bin/ublue-system-flatpak-manager @@ -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 diff --git a/usr/lib/systemd/system/ublue-system-flatpak-manager.service b/usr/lib/systemd/system/ublue-system-flatpak-manager.service index 41fe8ebd3bb..d3e1fe08ff5 100644 --- a/usr/lib/systemd/system/ublue-system-flatpak-manager.service +++ b/usr/lib/systemd/system/ublue-system-flatpak-manager.service @@ -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