aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2010-06-20 20:20:16 -0300
committerSilvio Rhatto <rhatto@riseup.net>2010-06-20 20:20:16 -0300
commitcb021c46ddb6616c33fa874a553f555893c8a22b (patch)
tree56d6ed69b759670ba67f1045eb49a8296c7683ae /lib
parentc0f1dc8e92c0bb6db735d27c68cc8c17637c6ff6 (diff)
downloadkeyringer-cb021c46ddb6616c33fa874a553f555893c8a22b.tar.gz
keyringer-cb021c46ddb6616c33fa874a553f555893c8a22b.tar.bz2
Adding system of preferences
Diffstat (limited to 'lib')
-rw-r--r--lib/keyringer/functions28
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