Set up notifications for package availability

This commit is contained in:
Ohad Livne 2025-06-04 22:45:50 +03:00
parent f5b17e863d
commit 9a40551ef5
Signed by: libohad-dev
GPG key ID: 34FDC68B51191A4D
2 changed files with 22 additions and 0 deletions

View file

@ -1 +1,2 @@
@hourly /home/ohad/.local/bin/make-backup @hourly /home/ohad/.local/bin/make-backup
@hourly /home/ohad/.local/bin/package-alert

21
.local/bin/package-alert Executable file
View file

@ -0,0 +1,21 @@
#! /usr/bin/sh
WATCHLIST=~/.local/share/package-alert/watchlist
agg_results=""
if [ -f "${WATCHLIST}" ]; then
for pattern in $(cat "${WATCHLIST}"); do
pat_results=$(apt-cache search --names-only "${pattern}")
if [ ! -z "${pat_results}" ]; then
agg_results="${agg_results:+${agg_results}
}Packages matching \"${pattern}\":
${pat_results}
"
fi
done
fi
if [ ! -z "${agg_results}" ]; then
printf '%s' "${agg_results}" | /usr/sbin/sendmail "${USER}"
fi