dotfiles/.config/dwm/scripts/checkUpdates.sh

23 lines
658 B
Bash
Raw Normal View History

2022-04-29 00:02:04 +02:00
#!/bin/bash
# Check updates on Arch Linux
# Note: Create cron on /etc/cron.d/checkupdates with the following lines:
# 0 * * * * root /usr/bin/pacman -Sy
# 30 * * * * root /usr/bin/pacman -Sy
if [ -f /usr/bin/pacman ] ; then
num_packages=$(pacman -Qu | wc -l)
2022-05-22 01:17:37 +02:00
echo "${num_packages} "
2022-04-29 00:02:04 +02:00
# Check updates on Ubuntu/Debian/Devuan
# Note: Create cron on /etc/cron.d/checkupdates with the following lines:
# 0 * * * * root /usr/bin/aptitude update
# 30 * * * * root /usr/bin/aptitude update
elif [ -f /usr/bin/aptitude ] ; then
num_packages=$(aptitude search "~U" | wc -l)
2022-05-22 01:17:37 +02:00
echo "${num_packages} "
2022-04-29 00:02:04 +02:00
# Disable for other distros
else
2022-05-22 01:17:37 +02:00
echo " 0 "
2022-04-29 00:02:04 +02:00
fi