aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README2
-rw-r--r--lib/keyringer/functions15
2 files changed, 15 insertions, 2 deletions
diff --git a/README b/README
index 7f1bbb6..b4ade4b 100644
--- a/README
+++ b/README
@@ -230,8 +230,6 @@ There are lots of things that can be enhanced, like:
- Encrypted and signed configuration files such as "recipients" and "options".
- - Configuration version tracking to help keyring upgrades.
-
Development
-----------
diff --git a/lib/keyringer/functions b/lib/keyringer/functions
index 0e61779..6395f2d 100644
--- a/lib/keyringer/functions
+++ b/lib/keyringer/functions
@@ -176,6 +176,7 @@ function keyringer_set_env {
KEYDIR="$BASEDIR/keys"
RECIPIENTS="$BASEDIR/config/recipients"
OPTIONS="$BASEDIR/config/options"
+ VERSION_INFO="$BASEDIR/config/version"
if [ -z "$BASEDIR" ]; then
keyringer_action_usage
@@ -208,6 +209,20 @@ function keyringer_set_env {
# Ensure that keydir exists
mkdir -p "$KEYDIR" && chmod 700 "$KEYDIR"
+
+ # Check keyring config version
+ keyringer_check_version
+}
+
+# Configuration version tracking to help keyring upgrades
+function keyringer_check_version {
+ if [ ! -f "$VERSION_INFO" ]; then
+ echo "Creating configuration version file..."
+ echo 0 > $VERSION_INFO
+ keyringer_exec git "$BASEDIR" add config/version
+ fi
+
+ VERSION="`cat $VERSION_INFO`"
}
# Get a file argument