diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2017-05-24 15:17:59 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2017-05-24 16:24:13 -0400 |
commit | 05128d533225b75f35f79a1f55b04556b7e9736b (patch) | |
tree | a2e8d723e76fd8e44c81ea0fbe1ad4dda597856d /src/toru | |
parent | d712e575c0d5b1bf66443beec3e7ed75be636e2d (diff) |
Merge conf.sh:load_files and conf.sh:check_vars into load_conf
Diffstat (limited to 'src/toru')
-rwxr-xr-x | src/toru/toru-path | 15 | ||||
-rwxr-xr-x | src/toru/toru-where | 3 |
2 files changed, 10 insertions, 8 deletions
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 "" } |