diff options
-rwxr-xr-x | keyringer | 4 | ||||
-rw-r--r-- | lib/keyringer/functions | 10 |
2 files changed, 13 insertions, 1 deletions
@@ -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 |