This repository has been archived on 2023-10-17. You can view files and clone it, but cannot push or open issues or pull requests.
dotfiles/.local/bin/voidup

23 lines
615 B
Text
Raw Normal View History

2022-11-01 19:23:41 +01:00
#!/bin/sh
TMP_UPDATES=/tmp/updates_void
[ -d "${TMP_UPDATES}" ] || mkdir "${TMP_UPDATES}"
xbps-install -nuM 1>"${TMP_UPDATES}"/updates 2>"${TMP_UPDATES}"/error
updates="$(awk 'END {print NR}' "${TMP_UPDATES}"/updates)"
broken="$(grep -c broken "${TMP_UPDATES}"/error)"
pkgs="$(awk '{print $1" ---> " $2}' "${TMP_UPDATES}"/updates)"
xx=$(printf "========================================")
if [ "$broken" = 0 ] && [ "$updates" -ge 1 ]; then
herbe "Available updates: $updates" "$xx" "$pkgs"
elif [ "$broken" -ge 1 ]; then
herbe "Broken pkgs:" "$xx" "$(cut -d " " -f 1,5 "${TMP_UPDATES}"/error)"
fi
exit 0