aboutsummaryrefslogtreecommitdiff
path: root/lib
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 /lib
parent12bbacc4e46b434bfd77e6f3ecaa871403741dbc (diff)
downloadkeyringer-27df78545696ec4e7d2d4da968c8140476af41fd.tar.gz
keyringer-27df78545696ec4e7d2d4da968c8140476af41fd.tar.bz2
Configuration version tracking to help keyring upgrades
Diffstat (limited to 'lib')
-rw-r--r--lib/keyringer/functions15
1 files changed, 15 insertions, 0 deletions
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