From 27df78545696ec4e7d2d4da968c8140476af41fd Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Thu, 18 Nov 2010 18:31:47 -0200 Subject: Configuration version tracking to help keyring upgrades --- README | 2 -- lib/keyringer/functions | 15 +++++++++++++++ 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 -- cgit v1.2.3