diff options
author | Luke Shumaker <LukeShu@sbcglobal.net> | 2012-11-12 16:54:55 -0500 |
---|---|---|
committer | Luke Shumaker <LukeShu@sbcglobal.net> | 2012-11-12 16:54:55 -0500 |
commit | 53da04831f410d86412361564b1018e9c72e4b66 (patch) | |
tree | 3cd5f6109f8104fdcb403cf6e1d1b82aad959321 /src | |
parent | a7158a6772f830ae8b40430e3c974356384eb3a4 (diff) |
libretools.conf: improve the "code" section at the end
* verify that XDG_CONFIG_HOME is set; if not, then set it
* warn about all unconfigured variables, not just the first one
* source the user-specific libretools.conf, if it exists
Diffstat (limited to 'src')
-rw-r--r-- | src/libretools.conf | 46 |
1 files changed, 30 insertions, 16 deletions
diff --git a/src/libretools.conf b/src/libretools.conf index d310776..cc8a8f1 100644 --- a/src/libretools.conf +++ b/src/libretools.conf @@ -84,22 +84,36 @@ TORUPATH=/var/lib/libretools/toru #SIGEXT=".sig" #SIGID="0xYOURID" -# Checks if vars aren't empty - +################################################################################ +# This probably shouldn't be in a .conf file... # +################################################################################ + +if [[ -z $XDG_CONFIG_HOME ]]; then + if [[ -n $SUDO_USER ]]; then + SUDO_HOME="$(eval echo ~$SUDO_USER)" + export XDG_CONFIG_HOME="${SUDO_HOME}/.config" + unset SUDO_HOME + else + export XDG_CONFIG_HOME="${HOME}/.config" + fi +fi +if [[ -e "$XDG_CONFIG_HOME/libretools/libretools.conf" ]]; then + . "$XDG_CONFIG_HOME/libretools/libretools.conf" +fi + +ret=0 for VAR in CHROOTDIR CHROOT CACHEDIR PARABOLAHOST LIBREDESTDIR \ - BLACKLIST WORKDIR REPOS ARCHES ABSLIBREGIT \ - COMMITCMD DIFFTOOL FULLBUILDCMD; do - - ret=0 - [[ -z ${!VAR} ]] && { - echo "Configure $VAR var in /etc/libretools.conf" - ret=1 - } - [ $ret -ne 0 ] && exit 1 -done + BLACKLIST WORKDIR REPOS ARCHES ABSLIBREGIT \ + COMMITCMD DIFFTOOL FULLBUILDCMD; do -source /usr/bin/libremessages + if [[ -z ${!VAR} ]]; then + echo "Configure $VAR var in /etc/libretools.conf" + ret=1 + fi +done +if [[ $ret != 0 ]]; then + exit 1 +fi +unset ret -## These are architecture specific files. -## Uncomment them if you installed libretools-mips64el -# source /etc/libretools.d/mips64el.conf +. /usr/bin/libremessages |