-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstallcheck-web.sh
More file actions
executable file
·31 lines (24 loc) · 943 Bytes
/
installcheck-web.sh
File metadata and controls
executable file
·31 lines (24 loc) · 943 Bytes
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
27
28
29
30
31
#!/bin/bash
# Run installcheck regularly, saving the results to the website and reporting checker status to a webhook.
shopt -s nullglob
DATE_PART="$(date +%Y%m%d-%s)"
OUTPUT_DIR="/srv/aptly-web/installcheck/${DATE_PART}"
URL_BASE="https://deb-master.utopia-repository.org/installcheck/${DATE_PART}"
script_dir="$(realpath "${0%/*}")"
mkdir -p "$OUTPUT_DIR" || exit 1
# TODO: this should report if some Packages list failed to download
"$script_dir"/installcheck.py -o "$OUTPUT_DIR" "$@"
webhook_text=""
for report in *.txt; do
webhook_text+=$"Installability check failed: ${URL_BASE}/${report}\n"
done
if [[ -z "$webhook_text" ]]; then
webhook_text="All installability checks passed"
fi
echo -e "$webhook_text"
if [[ -n "$WEBHOOK_URL" ]]; then
echo "Sending webhook announcement..."
echo -n "Webhook response: "
curl -d "{\"text\":\"$webhook_text\"}" -H 'Content-Type: application/json' \
"$WEBHOOK_URL"
fi