blob: 064dc85621733a2a6dee1bd916bab91ff7f2e3bd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
#!/usr/bin/env bash
trap 'echo ""; kill -- -$$' INT
# shellcheck source=../lib/load-configuration
. "${0%/*}/../lib/load-configuration"
runtail() {
# tail will quit with follow=name when the file is deleted
# thus no manual cleanup is needed
tail --follow=name "$1" -n +1 2>/dev/null &
}
# Check if we're already building something, and if so, tail it before we wait for new files
CURRENTLOG=$(printf '%s\n' "$work_dir/"tmp.build-packages.*/*.build-log | sort | tail -n 1)
if [[ -f $CURRENTLOG ]]; then
runtail "$CURRENTLOG"
fi
inotifywait -P -r -m "$work_dir" -e create --include '(\.build-log$)|(tmp\.build-packages\.[a-zA-Z0-9]+$)' --format '%w%f' -q |
while read -r FILE; do
if [[ -z $FILE || -d $FILE ]]; then
continue
fi
runtail "$FILE"
done
|