aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xkeyringer2
-rwxr-xr-xlib/bash/csr.sh (renamed from lib/keyringer/csr.sh)0
-rw-r--r--lib/bash/functions (renamed from lib/keyringer/functions)0
-rwxr-xr-xshare/keyringer/append2
-rwxr-xr-x[l---------]share/keyringer/append-batch36
-rwxr-xr-xshare/keyringer/decrypt2
-rwxr-xr-xshare/keyringer/del2
-rwxr-xr-xshare/keyringer/edit2
-rwxr-xr-xshare/keyringer/encrypt2
-rwxr-xr-x[l---------]share/keyringer/encrypt-batch27
-rwxr-xr-xshare/keyringer/genpair2
-rwxr-xr-xshare/keyringer/git2
-rwxr-xr-xshare/keyringer/ls2
-rwxr-xr-xshare/keyringer/options2
-rwxr-xr-xshare/keyringer/recipients2
-rwxr-xr-xshare/keyringer/recrypt2
16 files changed, 73 insertions, 14 deletions
diff --git a/keyringer b/keyringer
index d057975..376e2ae 100755
--- a/keyringer
+++ b/keyringer
@@ -134,7 +134,7 @@ ACTIONS="`dirname $(readlink -f $0)`/share/$NAME"
export PREFERENCES="`dirname $CONFIG`/$KEYRING"
# Load functions
-LIB="`dirname $(readlink -f $0)`/lib/$NAME/functions"
+LIB="`dirname $(readlink -f $0)`/lib/bash/functions"
source "$LIB" || exit 1
# Setup main configuration and load preferences
diff --git a/lib/keyringer/csr.sh b/lib/bash/csr.sh
index 881a46f..881a46f 100755
--- a/lib/keyringer/csr.sh
+++ b/lib/bash/csr.sh
diff --git a/lib/keyringer/functions b/lib/bash/functions
index 11d1b86..11d1b86 100644
--- a/lib/keyringer/functions
+++ b/lib/bash/functions
diff --git a/share/keyringer/append b/share/keyringer/append
index 045ba86..5570b6e 100755
--- a/share/keyringer/append
+++ b/share/keyringer/append
@@ -4,7 +4,7 @@
#
# Load functions
-LIB="`dirname $0`/../../lib/keyringer/functions"
+LIB="`dirname $0`/../../lib/bash/functions"
source "$LIB" || exit 1
# Get file
diff --git a/share/keyringer/append-batch b/share/keyringer/append-batch
index 6b140f7..5570b6e 120000..100755
--- a/share/keyringer/append-batch
+++ b/share/keyringer/append-batch
@@ -1 +1,35 @@
-append \ No newline at end of file
+#!/bin/bash
+#
+# Append information into encrypted files.
+#
+
+# Load functions
+LIB="`dirname $0`/../../lib/bash/functions"
+source "$LIB" || exit 1
+
+# Get file
+keyringer_get_file "$2"
+
+OLDIFS="$IFS"
+IFS=$'\n'
+
+CONTENT=($(keyringer_exec decrypt "$BASEDIR" "$FILE"))
+
+if [ "$BASENAME" == "append" ]; then
+ # only display directions if we're running append, not append-batch
+ printf "\n%s currently has %d lines\n\n" "$FILE" "${#CONTENT[@]}"
+ printf "Now please write the content to be appended on %s, finnishing with Ctrl-D:\n" "$FILE"
+fi
+
+# FIXME: dkg doesn't know how to check that this does proper escaping
+# (2010-11-16)
+
+APPEND=($(cat -))
+
+NEW=( ${CONTENT[@]} ${APPEND[@]} )
+
+for element in $(seq 0 $((${#NEW[@]} - 1))); do
+ echo ${NEW[$element]}
+done | keyringer_exec encrypt-batch $BASEDIR $FILE
+
+IFS="$OLDIFS"
diff --git a/share/keyringer/decrypt b/share/keyringer/decrypt
index c0584f2..c316e8d 100755
--- a/share/keyringer/decrypt
+++ b/share/keyringer/decrypt
@@ -4,7 +4,7 @@
#
# Load functions
-LIB="`dirname $0`/../../lib/keyringer/functions"
+LIB="`dirname $0`/../../lib/bash/functions"
source "$LIB" || exit 1
# Get file
diff --git a/share/keyringer/del b/share/keyringer/del
index 4eca0e3..b10d6a3 100755
--- a/share/keyringer/del
+++ b/share/keyringer/del
@@ -4,7 +4,7 @@
#
# Load functions
-LIB="`dirname $0`/../../lib/keyringer/functions"
+LIB="`dirname $0`/../../lib/bash/functions"
source "$LIB" || exit 1
# Get file
diff --git a/share/keyringer/edit b/share/keyringer/edit
index 0c25f64..6ece837 100755
--- a/share/keyringer/edit
+++ b/share/keyringer/edit
@@ -4,7 +4,7 @@
#
# Load functions
-LIB="`dirname $0`/../../lib/keyringer/functions"
+LIB="`dirname $0`/../../lib/bash/functions"
source "$LIB" || exit 1
# Get file
diff --git a/share/keyringer/encrypt b/share/keyringer/encrypt
index 8cbf72a..915af3c 100755
--- a/share/keyringer/encrypt
+++ b/share/keyringer/encrypt
@@ -4,7 +4,7 @@
#
# Load functions
-LIB="`dirname $0`/../../lib/keyringer/functions"
+LIB="`dirname $0`/../../lib/bash/functions"
source "$LIB" || exit 1
# Aditional parameters
diff --git a/share/keyringer/encrypt-batch b/share/keyringer/encrypt-batch
index 8267197..915af3c 120000..100755
--- a/share/keyringer/encrypt-batch
+++ b/share/keyringer/encrypt-batch
@@ -1 +1,26 @@
-encrypt \ No newline at end of file
+#!/bin/bash
+#
+# Encrypt files to multiple recipients.
+#
+
+# Load functions
+LIB="`dirname $0`/../../lib/bash/functions"
+source "$LIB" || exit 1
+
+# Aditional parameters
+keyringer_get_new_file "$2"
+
+# Encrypt
+mkdir -p "$KEYDIR/`dirname $FILE`"
+
+if [ "$BASENAME" == "encrypt" ]; then
+ # Only display directions if we're running encrypt, not encrypt-batch
+ echo "Type your message and finish your input with EOF (Ctrl-D)."
+fi
+
+gpg --use-agent --armor -e -s $(keyringer_recipients "$RECIPIENTS") - > "$KEYDIR/$FILE"
+
+# Stage
+if [ -d "$BASEDIR/.git" ]; then
+ keyringer_exec git "$BASEDIR" add "keys/$FILE"
+fi
diff --git a/share/keyringer/genpair b/share/keyringer/genpair
index a2aca98..5cb606f 100755
--- a/share/keyringer/genpair
+++ b/share/keyringer/genpair
@@ -140,7 +140,7 @@ function genpair_ssl {
}
# Load functions
-LIB="`dirname $0`/../../lib/keyringer"
+LIB="`dirname $0`/../../lib/bash"
source "$LIB/functions" || exit 1
# Aditional parameters
diff --git a/share/keyringer/git b/share/keyringer/git
index cd2a188..cd9879c 100755
--- a/share/keyringer/git
+++ b/share/keyringer/git
@@ -4,7 +4,7 @@
#
# Load functions
-LIB="`dirname $0`/../../lib/keyringer/functions"
+LIB="`dirname $0`/../../lib/bash/functions"
source "$LIB" || exit 1
# Aditional parameters
diff --git a/share/keyringer/ls b/share/keyringer/ls
index 31e8805..f63f95d 100755
--- a/share/keyringer/ls
+++ b/share/keyringer/ls
@@ -4,7 +4,7 @@
#
# Load functions
-LIB="`dirname $0`/../../lib/keyringer/functions"
+LIB="`dirname $0`/../../lib/bash/functions"
source "$LIB" || exit 1
# Aditional parameters
diff --git a/share/keyringer/options b/share/keyringer/options
index 3047380..abcca50 100755
--- a/share/keyringer/options
+++ b/share/keyringer/options
@@ -4,7 +4,7 @@
#
# Load functions
-LIB="`dirname $0`/../../lib/keyringer"
+LIB="`dirname $0`/../../lib/bash"
source "$LIB/functions" || exit 1
# Command parser
diff --git a/share/keyringer/recipients b/share/keyringer/recipients
index 2fe2ddf..abf4d94 100755
--- a/share/keyringer/recipients
+++ b/share/keyringer/recipients
@@ -4,7 +4,7 @@
#
# Load functions
-LIB="`dirname $0`/../../lib/keyringer"
+LIB="`dirname $0`/../../lib/bash"
source "$LIB/functions" || exit 1
# Command parser
diff --git a/share/keyringer/recrypt b/share/keyringer/recrypt
index a7607e0..2ea859b 100755
--- a/share/keyringer/recrypt
+++ b/share/keyringer/recrypt
@@ -4,7 +4,7 @@
#
# Load functions
-LIB="`dirname $0`/../../lib/keyringer/functions"
+LIB="`dirname $0`/../../lib/bash/functions"
source "$LIB" || exit 1
# Get file