fix: Improve flatpak update check logic
This commit is contained in:
@@ -301,20 +301,28 @@ function updateall
|
|||||||
set -l flatpak_status "skipped"
|
set -l flatpak_status "skipped"
|
||||||
set -l flatpak_color yellow
|
set -l flatpak_color yellow
|
||||||
if type -q flatpak and type -q timeout
|
if type -q flatpak and type -q timeout
|
||||||
set -l flatpak_has_updates 0
|
|
||||||
set -l flatpak_check (timeout 5s flatpak remote-ls --updates 2>&1)
|
set -l flatpak_tmp (mktemp)
|
||||||
|
timeout 5s flatpak remote-ls --updates >$flatpak_tmp 2>&1
|
||||||
set -l flatpak_check_code $status
|
set -l flatpak_check_code $status
|
||||||
|
set -l flatpak_check (cat $flatpak_tmp)
|
||||||
|
rm $flatpak_tmp
|
||||||
|
|
||||||
if test $flatpak_check_code -eq 0
|
if test $flatpak_check_code -eq 0
|
||||||
if test -z "$flatpak_check" # do not know why it works should maybe be test -n "$flatpak_check" instead of test -z "$flatpak_check"
|
if test -n "$flatpak_check" # do not know why it works should maybe be test -n "$flatpak_check" instead of test -z "$flatpak_check"
|
||||||
set flatpak_has_updates 1
|
set flatpak_has_updates 1
|
||||||
end
|
end
|
||||||
else if test $flatpak_check_code -eq 1
|
else if test $flatpak_check_code -eq 124
|
||||||
echo "flatpak: no updates available"
|
set flatpak_has_updates 2
|
||||||
else
|
else
|
||||||
set flatpak_has_updates 0
|
set flatpak_has_updates 0
|
||||||
end
|
end
|
||||||
|
|
||||||
if test $flatpak_has_updates -eq 1
|
if test $flatpak_has_updates -eq 2
|
||||||
|
echo "flatpak: update check failed"
|
||||||
|
set flatpak_status "update check failed"
|
||||||
|
set flatpak_color red
|
||||||
|
else if test $flatpak_has_updates -eq 1
|
||||||
echo "flatpak: up to date"
|
echo "flatpak: up to date"
|
||||||
set flatpak_status "up to date"
|
set flatpak_status "up to date"
|
||||||
set flatpak_color green
|
set flatpak_color green
|
||||||
|
|||||||
Reference in New Issue
Block a user