aboutsummaryrefslogtreecommitdiff
path: root/trunk/lib/common.sh
diff options
context:
space:
mode:
Diffstat (limited to 'trunk/lib/common.sh')
-rw-r--r--trunk/lib/common.sh9
1 files changed, 6 insertions, 3 deletions
diff --git a/trunk/lib/common.sh b/trunk/lib/common.sh
index 39199ac..2425ca8 100644
--- a/trunk/lib/common.sh
+++ b/trunk/lib/common.sh
@@ -20,6 +20,7 @@
BASE_CONF="/etc/simplepkg"
CONF="$BASE_CONF/simplepkg.conf"
+HOME_CONF="$HOME/.simplepkg/simplepkg.conf"
DEFAULT_CONF="$BASE_CONF/defaults/simplepkg.conf"
JAIL_LIST="$BASE_CONF/jailist"
SIMPLARET="simplaret"
@@ -136,12 +137,14 @@ function remove_packages {
function eval_parameter {
- # usage: eval $1 parameter from $CONF or $DEFAULT_CONF
+ # usage: eval $1 parameter from $HOME_CONF, $CONF or $DEFAULT_CONF
# return the evaluated parameter if available or $2 $3 ... $n
- if grep -qe "^$1=" $CONF; then
+ if [ -e "$HOME_CONF" ] && grep -qe "^$1=" $HOME_CONF; then
+ grep -e "^$1=" $HOME_CONF | cut -d = -f 2 | sed -e 's/"//g' -e "s/'//g" | sed -e 's/ *#.*$//'
+ elif [ -e "$CONF" ] && grep -qe "^$1=" $CONF; then
grep -e "^$1=" $CONF | cut -d = -f 2 | sed -e 's/"//g' -e "s/'//g" | sed -e 's/ *#.*$//'
- elif grep -qe "^$1=" $DEFAULT_CONF; then
+ elif [ -e "$DEFAULT_CONF" ] && grep -qe "^$1=" $DEFAULT_CONF; then
grep -e "^$1=" $DEFAULT_CONF | cut -d = -f 2 | sed -e 's/"//g' -e "s/'//g" | sed -e 's/ *#.*$//'
else
shift