diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2010-06-20 20:20:16 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2010-06-20 20:20:16 -0300 |
commit | cb021c46ddb6616c33fa874a553f555893c8a22b (patch) | |
tree | 56d6ed69b759670ba67f1045eb49a8296c7683ae /lib | |
parent | c0f1dc8e92c0bb6db735d27c68cc8c17637c6ff6 (diff) | |
download | keyringer-cb021c46ddb6616c33fa874a553f555893c8a22b.tar.gz keyringer-cb021c46ddb6616c33fa874a553f555893c8a22b.tar.bz2 |
Adding system of preferences
Diffstat (limited to 'lib')
-rw-r--r-- | lib/keyringer/functions | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/keyringer/functions b/lib/keyringer/functions index 19d677f..af84212 100644 --- a/lib/keyringer/functions +++ b/lib/keyringer/functions @@ -3,6 +3,34 @@ # Common functions. # +# Setup main configuration and load preferences +function keyringer_config_load { + if [ -f "$HOME/.$NAME" ]; then + echo "Converting legacy configuration scheme..." + mv $HOME/.$NAME $HOME/.$NAME.tmp + mkdir $HOME/.$NAME + mv $HOME/.$NAME.tmp $CONFIG + fi + + if [ ! -e "$CONFIG" ]; then + echo "Creating $CONFIG..." + mkdir `dirname $CONFIG` + touch $CONFIG + chmod 600 $CONFIG + echo "# Keyringer config file." > $CONFIG + echo "" >> $CONFIG + fi + + keyringer_config_load_preferences +} + +function keyringer_config_load_preferences { + # Load custom keyring preferences + if [ ! -z "$PREFERENCES" ] && [ -e "$PREFERENCES" ]; then + source $PREFERENCES + fi +} + # Load a parameter from config function keyringer_config { if [ -z "$CONFIG" ]; then |