]>
Commit | Line | Data |
---|---|---|
338aaca9 ER |
1 | #!/bin/sh |
2 | # Walks your %_topdir (or any other dir specified by $1) and checks with pldnotify.awk for updates | |
3 | # and shows only relevant diffs of those packages only. | |
4 | # | |
5 | # Setup your cron to give you work early morning :) | |
6 | # 6 30 * * * /some/path/pldnotify.sh | |
7 | # | |
8 | # Idea based on PLD-doc/notify-specsupdate.sh script | |
9 | # Author: Elan Ruusamäe <glen@pld-linux.org> | |
10 | ||
11 | set -e | |
12 | dir=$(dirname "$0") | |
13 | topdir=${1:-$(rpm -E %_topdir)} | |
14 | pldnotify=${0%/*}/pldnotify.awk | |
15 | debug=0 | |
16 | ||
17 | # run pldnotify with debug mode if this script executed with "-x" | |
18 | case "$-" in | |
19 | *x*) | |
20 | debug=1 | |
21 | ;; | |
22 | esac | |
23 | ||
24 | xtitle() { | |
25 | local prefix="[$(date '+%Y-%m-%d %H:%M:%S')] pldnotify: " | |
26 | local msg="$prefix"$(echo "$*" | tr -d '\r\n') | |
27 | case "$TERM" in | |
28 | cygwin|xterm*) | |
29 | echo >&2 -ne "\033]1;$msg\007\033]2;$msg\007" | |
30 | ;; | |
31 | screen*) | |
32 | echo >&2 -ne "\033]0;$msg\007" | |
33 | ;; | |
34 | esac | |
35 | echo "$msg" | |
36 | } | |
37 | ||
38 | xtitle "Checking packages in $topdir/*" | |
39 | for spec in $topdir/*/*.spec; do | |
40 | pkg=${spec##*/} | |
41 | ||
42 | xtitle "Checking $pkg" | |
43 | out=$($pldnotify -vDEBUG=$debug < $spec); rc=$? | |
44 | if [ $rc != 0 ]; then | |
45 | echo >&2 "$out" | |
46 | continue | |
47 | fi | |
48 | ||
49 | echo "$out" | grep -v "seems ok" || : | |
50 | done |