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
diego castillo salazar 9a82d82fd6 Update dotfiles
2023-04-21 12:33:06 -05:00

22 lines
615 B
Bash
Executable file

#!/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