summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2012-02-27 12:50:29 -0300
committerSilvio Rhatto <rhatto@riseup.net>2012-02-27 12:50:29 -0300
commit7c064f5202c9ae9915ae92f684831f2059d3e3a9 (patch)
tree999692bdd73281a58d12078ae6095181ed62fd29
parente6d3f3e0c5671ff853404a962d856ec493b8dbdb (diff)
downloadkeyringer-7c064f5202c9ae9915ae92f684831f2059d3e3a9.tar.gz
keyringer-7c064f5202c9ae9915ae92f684831f2059d3e3a9.tar.bz2
Check if config version is supported by keyringer
-rwxr-xr-xkeyringer4
-rw-r--r--lib/keyringer/functions10
2 files changed, 13 insertions, 1 deletions
diff --git a/keyringer b/keyringer
index 8904685..8a6eeb1 100755
--- a/keyringer
+++ b/keyringer
@@ -129,14 +129,16 @@ function keyringer_preferences {
# Config
NAME="keyringer"
+KEYRINGER_VERSION="0.1"
CONFIG="$HOME/.$NAME/config"
BASENAME="`basename $0`"
KEYRING="$1"
ACTION="$2"
ACTIONS="`dirname $(readlink -f $0)`/share/$NAME"
-# Export preferences for other scripts
+# Export preferences and version for other scripts
export PREFERENCES="`dirname $CONFIG`/$KEYRING"
+export KEYRINGER_VERSION
# Load functions
LIB="`dirname $(readlink -f $0)`/lib/$NAME/functions"
diff --git a/lib/keyringer/functions b/lib/keyringer/functions
index a1c95a8..8166370 100644
--- a/lib/keyringer/functions
+++ b/lib/keyringer/functions
@@ -234,6 +234,16 @@ function keyringer_check_version {
fi
VERSION="`cat $VERSION_INFO`"
+
+ # Check if config version is supported by keyringer
+ if [ "$VERSION" != "$KEYRINGER_VERSION" ]; then
+ NEWEST="`echo -e "$VERSION\n$KEYRINGER_VERSION" | sort -V | tail -n 1`"
+ if [ "$NEWEST" == "$VERSION" ]; then
+ echo "Fatal: keyringer version: $KEYRINGER_VERSION / config version: $VERSION"
+ echo "Please upgrade your keyringer application"
+ exit 1
+ fi
+ fi
}
# Configuration upgrades