updates_void: corrección y simplificación de código

This commit is contained in:
Tuxliban Torvalds 2022-01-13 13:23:22 -06:00
parent 1a95b3a24b
commit adff25920d

View file

@ -1,24 +1,25 @@
#!/bin/sh
/usr/bin/xbps-install.static -nuM 1>/tmp/updates 2>/tmp/error
TMP_UPDATES=/tmp/updates_void
[ -d "${TMP_UPDATES}" ] || mkdir "${TMP_UPDATES}"
updates="$(wc -l < /tmp/updates)"
broken="$(grep -c broken /tmp/error)"
pkg="$(awk '{print $1" ---> "$2}' /tmp/updates)"
pkgs="$(awk '{print $1}' /tmp/updates)"
xx=$(printf "==============================")
#/usr/bin/xbps-install.static -nuM 1>/tmp/updates 2>/tmp/error
xbps-install -nuM 1>"${TMP_UPDATES}"/updates 2>"${TMP_UPDATES}"/error
updates="$(wc -l < "${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
"$HOME"/Dropbox/Gitea/scripts/varios/dunst_sound
if [ "$updates" -eq 1 ]; then
herbe "ACTUALIZACIÓN DISPONIBLE:" "$xx $pkg"
elif [ "$updates" -gt 1 ]; then
herbe "ACTUALIZACIONES DISPONIBLES: $updates" "$xx $pkgs"
else
echo ""
fi
herbe "ACTUALIZACIONES DISPONIBLES: $updates" "$xx" "$pkgs"
else
echo ""
fi
if [ "$broken" -ge 1 ]; then
herbe "HAY PAQUETES ROTOS:" "$xx" "$(cut -d " " -f 1,5 /tmp/error)"
herbe "HAY PAQUETES ROTOS:" "$xx" "$(cut -d " " -f 1,5 "${TMP_UPDATES}"/error)"
fi
exit 0