[pacman-contrib] [PATCH] checkupdates: report failure to fetch updates

Andrew Barchuk andrew at raindev.io
Mon Aug 21 20:05:38 UTC 2017


Exit the script with 1 if pacman -Sy call failed. This would let a user
to distinguish whether there're no updates or pacman failed to fetch
them.

Fixes FS#55206

Signed-off-by: Andrew Barchuk <andrew at raindev.io>
---
 src/checkupdates.sh.in | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/checkupdates.sh.in b/src/checkupdates.sh.in
index 4162548..8b9a292 100644
--- a/src/checkupdates.sh.in
+++ b/src/checkupdates.sh.in
@@ -53,7 +53,10 @@ fi
 
 mkdir -p "$CHECKUPDATES_DB"
 ln -s "${DBPath}/local" "$CHECKUPDATES_DB" &> /dev/null
-fakeroot -- pacman -Sy --dbpath "$CHECKUPDATES_DB" --logfile /dev/null
&> /dev/null
+if ! fakeroot -- pacman -Sy --dbpath "$CHECKUPDATES_DB" --logfile
/dev/null &> /dev/null; then
+       error 'Cannot fetch updates'
+       exit 1
+fi
 pacman -Qu --dbpath "$CHECKUPDATES_DB" 2> /dev/null | grep -v '\[.*\]'
 
 exit 0
-- 
2.14.1


More information about the pacman-contrib mailing list