From ac4dcb64a8f6c07dfe50e9005dc4246f21ebf84e Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sat, 6 Sep 2014 00:39:14 -0400 Subject: Split hackers.yml into users/#{uid}.yml --- bin/meta-check | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100755 bin/meta-check (limited to 'bin/meta-check') diff --git a/bin/meta-check b/bin/meta-check new file mode 100755 index 0000000..3eeb4c1 --- /dev/null +++ b/bin/meta-check @@ -0,0 +1,38 @@ +#!/bin/bash +# TODO: update to the split YAML files + +###################################################################### + +. libremessages + +file=$cfg_hackers +ret=0 + +norm=$(mktemp --tmpdir) +trap "rm -f -- $(printf '%q' "$norm")" EXIT +"$(dirname "$0")/meta-normalize-stdio" < "$file" > "$norm" || exit 1 + +usernames=($(<"$norm" sed -n 's/^[ -] username: //p' | sort)) + +dups=($(printf '%s\n' "${usernames[@]}" | uniq -d)) +if (( ${#dups[@]} )); then + error 'Duplicate usernames:' + plain '%s' "${dups[@]}" + ret=1 +fi + +illegal=($(printf '%s\n' "${usernames[@]}" | grep -v '^[a-z][a-z0-9]*$')) +if (( ${#illegal[@]} )); then + error 'Illegal usernames:' + plain '%s' "${illegal[@]}" + ret=1 +fi + +if "$(dirname "$0")/list-pgp-keyids" | grep -Ev '^(trusted|secondary|revoked)/[a-z][a-z0-9]* [0-9A-F]{40}$'; then + error 'Bad pgp keys ^^^' + ret=1 +fi + +colordiff -u "$file" "$norm" || ret=$? + +exit $ret -- cgit v1.2.2