#
# Written by
# Jameson Rollins <jrollins@fifthhorseman.net>
+# Jamie McClelland <jm@mayfirst.org>
+# Daniel Kahn Gillmor <dkg@fifthhorseman.net>
#
# Copyright 2008, released under the GPL, version 3 or later
local priority
local level
local output
+ local alllevels
+ local found=
+
+ # don't include SILENT in alllevels: it's handled separately
+ # list in decreasing verbosity (all caps).
+ # separate with $IFS explicitly, since we do some fancy footwork
+ # elsewhere.
+ alllevels="DEBUG${IFS}INFO${IFS}ERROR"
# translate lowers to uppers in global log level
LOG_LEVEL=$(echo "$LOG_LEVEL" | tr "[:lower:]" "[:upper:]")
return
fi
+ for level in $alllevels ; do
+ if [ "$LOG_LEVEL" = "$level" ] ; then
+ found=true
+ fi
+ done
+ if [ -z "$found" ] ; then
+ # default to INFO:
+ LOG_LEVEL=INFO
+ fi
+
# get priority from first parameter, translating all lower to
# uppers
priority=$(echo "$1" | tr "[:lower:]" "[:upper:]")
shift
# scan over available levels
- # list in decreasing verbosity (all caps)
- for level in DEBUG INFO ERROR ; do
+ for level in $alllevels ; do
# output if the log level matches, set output to true
- # this will output for all subsequenty loops as well.
+ # this will output for all subsequent loops as well.
if [ "$LOG_LEVEL" = "$level" ] ; then
output=true
fi
# if the gpg query return code is not 0, return 1
if [ "$?" -ne 0 ] ; then
- log error " no primary keys found."
+ log info " no primary keys found."
return 1
fi
lastKeyOK=
fingerprint=
- log error " primary key found: $keyid"
+ log info " primary key found: $keyid"
# if overall key is not valid, skip
if [ "$validity" != 'u' -a "$validity" != 'f' ] ; then
# output a line for the primary key
# 0 = ok, 1 = bad
if [ "$keyOK" -a "$uidOK" -a "$lastKeyOK" ] ; then
- log error " * acceptable primary key."
+ log info " * acceptable primary key."
if [ -z "$sshKey" ] ; then
log error " ! primary key could not be translated (not RSA or DSA?)."
else
# output a line for the sub key
# 0 = ok, 1 = bad
if [ "$keyOK" -a "$uidOK" -a "$lastKeyOK" ] ; then
- log error " * acceptable sub key."
+ log info " * acceptable sub key."
if [ -z "$sshKey" ] ; then
log error " ! sub key could not be translated (not RSA or DSA?)."
else