From 05128d533225b75f35f79a1f55b04556b7e9736b Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 24 May 2017 15:17:59 -0400 Subject: Merge conf.sh:load_files and conf.sh:check_vars into load_conf --- src/toru/toru-path | 15 +++++++++------ src/toru/toru-where | 3 +-- 2 files changed, 10 insertions(+), 8 deletions(-) (limited to 'src/toru') diff --git a/src/toru/toru-path b/src/toru/toru-path index f2445a6..611a857 100755 --- a/src/toru/toru-path +++ b/src/toru/toru-path @@ -54,11 +54,7 @@ usage() { main() { setup_traps - load_files libretools - load_files abs - # TODO: better option parsing - TORUPATH=${T:-${TORUPATH}} VERBOSE=${V:-false} FORCE=${F:-false} # TODO: add an option to override/augment libretools.conf:REPOS @@ -71,8 +67,15 @@ main() { return 2 fi - check_vars libretools TORUPATH REPOS || return 1 - check_vars abs ABSROOT || return 1 + declare -i ret=0 + if [[ -n "${T:-}" ]]; then + load_conf libretools.conf REPOS || ret=$? + TORUPATH=$T + else + load_conf libretools.conf TORUPATH REPOS || ret=$? + fi + load_conf abs.conf ABSROOT || ret=$? + [[ $ret = 0 ]] || exit $ret if [ ! -w "$TORUPATH" ]; then error "Toru's path isn't writable. Please check your TORUPATH: %q" "$TORUPATH" diff --git a/src/toru/toru-where b/src/toru/toru-where index ba7fb0a..5eb491b 100755 --- a/src/toru/toru-where +++ b/src/toru/toru-where @@ -21,8 +21,7 @@ . "$(librelib conf)" main() { - load_files libretools - check_vars libretools TORUPATH || exit 1 + load_conf libretools.conf TORUPATH || exit tcamgr get "${TORUPATH}/paths.tch" "$1" 2>/dev/null || echo "" } -- cgit v1.2.2