summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2010-11-18 18:31:47 -0200
committerSilvio Rhatto <rhatto@riseup.net>2010-11-18 18:31:47 -0200
commit27df78545696ec4e7d2d4da968c8140476af41fd (patch)
tree87c0d666d1f95cf9499c16cd9a2db957f45ac1ae
parent12bbacc4e46b434bfd77e6f3ecaa871403741dbc (diff)
downloadkeyringer-27df78545696ec4e7d2d4da968c8140476af41fd.tar.gz
keyringer-27df78545696ec4e7d2d4da968c8140476af41fd.tar.bz2
Configuration version tracking to help keyring upgrades
-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