Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/bin/manage-fail-reasons
diff options
context:
space:
mode:
Diffstat (limited to 'bin/manage-fail-reasons')
-rwxr-xr-xbin/manage-fail-reasons13
1 files changed, 7 insertions, 6 deletions
diff --git a/bin/manage-fail-reasons b/bin/manage-fail-reasons
index f110889..eaa7ff5 100755
--- a/bin/manage-fail-reasons
+++ b/bin/manage-fail-reasons
@@ -23,15 +23,15 @@ case "$1" in
# shellcheck disable=SC2016
fail_reason_identifiers=$(
{
- printf 'SELECT `fail_reasons`.`id`,`fail_reasons`.`severity`,replace(to_base64(`fail_reasons`.`identifier`),"\\n","")'
+ printf 'SELECT `fail_reasons`.`id`,name,`fail_reasons`.`severity`,replace(to_base64(`fail_reasons`.`identifier`),"\\n","")'
printf ' FROM `fail_reasons` ORDER BY `fail_reasons`.`severity` ASC, `fail_reasons`.id ASC'
} | \
mysql_run_query
)
printf '%s\n' "${fail_reason_identifiers}" | \
- while read -r reason_id severity identifier; do
+ while read -r reason_id name severity identifier; do
ident=$(printf '%s' "${identifier}" | base64 -d -)
- printf "%02s %03s %s\n" "$reason_id" "$severity" "$ident"
+ printf "%s %s %s %s\n" "$reason_id" "$name" "$severity" "$ident"
done
;;
'check')
@@ -53,13 +53,13 @@ case "$1" in
esac
fail_reason_identifiers=$(
{
- printf 'SELECT id,severity,replace(to_base64(`fail_reasons`.`identifier`),"\\n","")'
+ printf 'SELECT id,severity,name,replace(to_base64(`fail_reasons`.`identifier`),"\\n","")'
printf ' FROM `fail_reasons` ORDER BY `fail_reasons`.`severity` ASC, `fail_reasons`.id ASC'
} | \
mysql_run_query
)
printf '%s\n' "${fail_reason_identifiers}" | \
- while read -r id severity identifier; do
+ while read -r id severity name identifier; do
if zgrep -qx "\s*$(
printf '%s' "${identifier}" | \
base64 -d
@@ -67,9 +67,10 @@ case "$1" in
"$filelog"; then
echo 'match'
ident=$(printf '%s' "${identifier}" | base64 -d -)
- printf "$id ($ident) matches with severity $severity\n"
+ printf "$name ($id, $ident) matches with severity $severity\n"
fi
done
+ zcat "$filelog" | tail -n 4
;;
*)
>&2 printf 'unknown action "%s"\n' "$1"