Store keys in .blackbox directory (#218)

This commit is contained in:
Aymeric Beaumet
2017-09-18 00:13:36 +02:00
committed by Tom Limoncelli
parent 103106e08f
commit 60e782a09e
2 changed files with 36 additions and 23 deletions

View File

@@ -15,9 +15,12 @@ source "${0%/*}"/_stack_lib.sh
# Where are we?
: "${BLACKBOX_HOME:="$(cd "${0%/*}" ; pwd)"}" ;
# Where in the VCS repo should the blackbox data be found?
: "${BLACKBOXDATA:=keyrings/live}" ; # If BLACKBOXDATA not set, set it.
# What are the candidates for the blackbox data directory?
declare -a BLACKBOXDATA_CANDIDATES
BLACKBOXDATA_CANDIDATES=(
'keyrings/live'
'.blackbox'
)
# If $EDITOR is not set, set it to "vi":
: "${EDITOR:=vi}" ;
@@ -67,6 +70,16 @@ if [[ -n "$BLACKBOX_REPOBASE" ]]; then
export REPOBASE="$BLACKBOX_REPOBASE"
fi
if [ -z "$BLACKBOXDATA" ] ; then
BLACKBOXDATA="${BLACKBOXDATA_CANDIDATES[0]}"
for candidate in ${BLACKBOXDATA_CANDIDATES[@]} ; do
if [ -d "$REPOBASE/$candidate" ] ; then
BLACKBOXDATA="$candidate"
break
fi
done
fi
KEYRINGDIR="$REPOBASE/$BLACKBOXDATA"
BB_ADMINS_FILE="blackbox-admins.txt"
BB_ADMINS="${KEYRINGDIR}/${BB_ADMINS_FILE}"