LIB="`dirname $0`/../functions"
source "$LIB" || exit 1
+# Dispatch
keyringer_show_actions
# Decrypt the information to the file
$GPG --yes -o "$TMPWORK" --use-agent -d "$KEYDIR/$FILE"
+# Action check
if [ "$BASENAME" == "edit" ]; then
APP="$EDITOR"
elif [ "$BASENAME" == "open" ]; then
keyringer_encrypt $FILE $UNENCRYPTED_FILE
fi
+# Check exit status
err="$?"
-
if [ "$err" != "0" ]; then
exit "$err"
fi
+# Wipe information
if [ "$UNENCRYPTED_FILE" != "-" ]; then
echo "Done. PLEASE WIPE the non-encrypted $UNENCRYPTED_FILE."
fi
keyringer_exec git "$BASEDIR" add "keys/$FILE"
fi
+# Done
exit "$?"
keyringer_exec git "$BASEDIR" add config/options
fi
+# Dispatch
if [ "$COMMAND" == "ls" ]; then
cat "$OPTIONS"
elif [ "$COMMAND" == "edit" ]; then
LIB="`dirname $0`/../functions"
source "$LIB" || exit 1
+# Options
COMMAND="$2"
+# Syntax check
if [ -z "$COMMAND" ]; then
echo "Usage: keyringer <keyring> preferences <command> [arguments]"
echo "Available commands:"
touch "$PREFERENCES"
fi
+# Dispatch
if [ "$COMMAND" == "ls" ]; then
cat "$PREFERENCES"
elif [ "$COMMAND" == "edit" ]; then
# Set recipients file
keyringer_set_new_recipients "$3"
+# Syntax check and dispatcher
if [ "$COMMAND" == "ls" ]; then
if [ ! -z "$3" ]; then
if [ -e "$RECIPIENTS_FILE" ]; then
LIB="`dirname $0`/../functions"
source "$LIB" || exit 1
+# Recrypt a single secret
function keyringer_recrypt {
# Get file
keyringer_get_file "$1"
echo "$recrypted" > "$KEYDIR/$FILE"
}
+# Syntax check and dispatcher
if [ ! -z "$2" ]; then
keyringer_recrypt $2
else
# Options
CONFIRM="$2"
+# Confirmation
if [ -z "$CONFIRM" ] || [ "$CONFIRM" != "-y" ]; then
echo "WARNING: about to remove the LOCAL copy of $KEYRING"
echo "WARNING: This will irrevocably destroy $KEYDIR"
#!/bin/bash
#
-# List keys.
+# List keys, tree version.
#
# Thanks http://www.centerkey.com/tree/
LIB="`dirname $0`/../functions"
source "$LIB" || exit 1
+# Dispatch
keyringer_usage $KEYRING