Set up notifications for package availability
This commit is contained in:
parent
f5b17e863d
commit
9a40551ef5
2 changed files with 22 additions and 0 deletions
|
|
@ -1 +1,2 @@
|
|||
@hourly /home/ohad/.local/bin/make-backup
|
||||
@hourly /home/ohad/.local/bin/package-alert
|
||||
|
|
|
|||
21
.local/bin/package-alert
Executable file
21
.local/bin/package-alert
Executable 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue