From 53da04831f410d86412361564b1018e9c72e4b66 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 12 Nov 2012 16:54:55 -0500 Subject: 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 --- src/libretools.conf | 46 ++++++++++++++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 16 deletions(-) (limited to 'src/libretools.conf') 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 -- cgit v1.2.2