Révision c2aa5653
Plugin pacman_pending_updates: handle absence of available updates properly
"checkupdates" returns the exit code 2, if no updates are pending.
Previously the plugin did not output anything in this case.
Closes: #1233
| plugins/other/pacman_pending_updates | ||
|---|---|---|
| 58 | 58 |
;; |
| 59 | 59 |
|
| 60 | 60 |
*) |
| 61 |
if updates="$(checkupdates)"; then |
|
| 61 |
updates="$(checkupdates)" |
|
| 62 |
exitcode=$? |
|
| 63 |
if [ "$exitcode" = 0 ]; then |
|
| 62 | 64 |
if [ -n "$updates" ]; then |
| 63 | 65 |
echo "updates.value $(echo "$updates" | wc -l)" |
| 64 | 66 |
echo "updates.extinfo $(echo "$updates" | paste -s -d,)" |
| 65 | 67 |
else |
| 66 |
echo updates.value 0
|
|
| 68 |
echo "updates.value 0"
|
|
| 67 | 69 |
fi |
| 68 |
echo "updates.value U" && exit |
|
| 70 |
elif [ "$exitcode" = 2 ]; then |
|
| 71 |
# Surprisingly "checkupdates" returns the exitcode 2, if all packages are |
|
| 72 |
# up to date. |
|
| 73 |
echo "updates.value 0" |
|
| 74 |
else |
|
| 75 |
echo "updates.value U" |
|
| 69 | 76 |
fi |
| 70 | 77 |
;; |
| 71 | 78 |
esac |
Formats disponibles : Unified diff