From 12ecae94ad6930d9d36374c0175dfb9762acfb26 Mon Sep 17 00:00:00 2001 From: rhatto Date: Sat, 3 Jan 2009 21:55:14 +0000 Subject: attempting to fix #65 git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@729 04377dda-e619-0410-9926-eae83683ac58 --- trunk/lib/common.sh | 9 ++++++--- trunk/src/simplaret | 4 +++- 2 files changed, 9 insertions(+), 4 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 diff --git a/trunk/src/simplaret b/trunk/src/simplaret index a1ffe2d..61ae7a4 100755 --- a/trunk/src/simplaret +++ b/trunk/src/simplaret @@ -28,7 +28,9 @@ else exit 1 fi -if [ -f "/etc/simplepkg/repos.conf" ]; then +if [ -f "$HOME/.simplepkg/repos.conf" ]; then + REPOS_CONF="$HOME/.simplepkg/repos.conf" +elif [ -f "/etc/simplepkg/repos.conf" ]; then REPOS_CONF="/etc/simplepkg/repos.conf" else REPOS_CONF="/etc/simplepkg/defaults/repos.conf" -- cgit v1.2.3