fix checkup script
This commit is contained in:
parent
44d25b3314
commit
46c63488bb
1 changed files with 7 additions and 17 deletions
|
@ -4,21 +4,11 @@ askupgrade() {
|
|||
[ "$(notify-send -c updates --action=Yes=Yes --action=No=No " Repository Sync" "Updates available. Update now?")" = 'Yes' ] && $TERMINAL -e upgrades
|
||||
}
|
||||
|
||||
if command -v apt 1>/dev/null 2>&1; then
|
||||
n=$(sudo apt upgrade -dy 2>/dev/null | grep -m1 '^[0-9]\+ upgraded,' | tr -cd '0-9' | cut -c1-2)
|
||||
if [ "$n" = '' ]; then
|
||||
notify-send -u critical "Error downloading updates." "Check your internet connection, if apt is already running, or run update manually to see errors."
|
||||
elif [ "$n" != 00 ]; then
|
||||
askupgrade
|
||||
fi
|
||||
elif command -v xbps-install 1>/dev/null 2>&1; then
|
||||
xbps-install -nuM 1>/tmp/xbps_updates 2>/tmp/xbps_errors
|
||||
n="$(wc -l </tmp/xbps_updates)"
|
||||
ne="$(grep -c broken /tmp/xbps_errors)"
|
||||
n="$(xbps-install -M -n -u | grep -Fec update -e install)"
|
||||
if [ "$n" != "0" ] && [ "$ne" != "0" ]; then
|
||||
notify-send -u critical "Error downloading updates." "$(cut -d " " -f 1,5 /tmp/xbps_errors)"
|
||||
elif [ "$n" -gt 1 ] && [ "$ne" = "0" ]; then
|
||||
askupgrade
|
||||
fi
|
||||
xbps-install -nuM 1>/tmp/xbps_updates 2>/tmp/xbps_errors
|
||||
ne="$(grep -c broken /tmp/xbps_errors)"
|
||||
n="$(grep -c -e update -e install /tmp/xbps_updates)"
|
||||
if [ "$n" != "0" ] && [ "$ne" != "0" ]; then
|
||||
notify-send -u critical "Error downloading updates." "$(cut -d " " -f 1,5 /tmp/xbps_errors)"
|
||||
elif [ "$n" -gt 1 ] && [ "$ne" = "0" ]; then
|
||||
askupgrade
|
||||
fi
|
||||
|
|
Loading…
Add table
Reference in a new issue