pacman_pending_updates outputs nothing if no updates
solsticedhiver opened this issue · comments
solsTiCe d'Hiver commented
The plugin at plugins/other/pacman_pending_updates
is broken when no updates are available. It outputs nothing, and it seems the node is not responding.
checkupdates
shows no output if there is no available updates but also returns 2 as return code.
This means the if blocks of the script is not run.
One need to change the code or take care of return code 2
solsTiCe d'Hiver commented
Here is a patch of a possible fix:
--- plugins/other/pacman_pending_updates 2021-07-29 12:20:52.106602427 +0200
+++ plugins/other/pacman_pending_updates 2021-07-29 12:11:32.030467191 +0200
@@ -58,16 +58,20 @@
;;
*)
- if updates="$(checkupdates)"; then
+ updates="$(checkupdates)"
+ ret=$?
+ if [ $ret -eq 0 ] ; then
if [ -n "$updates" ]; then
echo "updates.value $(echo "$updates" | wc -l)"
echo "updates.extinfo $(echo "$updates" | paste -s -d,)"
- else
- echo updates.value 0
fi
echo "updates.value U" && exit
fi
+ if [ $ret -eq 2 ] ; then
+ echo updates.value 0
+ fi
;;
esac
exit 0
+
Lars Kruse commented
Thank you for your suggestion!
I implemented an equivalent fix now.