From 42ed1183c123e9afb7fddadbbc4e62d89f82b63d Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 1 Oct 2014 16:50:35 -0400 Subject: conf.sh: make sysconfdir overridable at runtime, use this for testing --- src/lib/conf.sh.in | 13 +++++++------ test/testenv | 3 ++- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/lib/conf.sh.in b/src/lib/conf.sh.in index fa66016..6a2a3b0 100644 --- a/src/lib/conf.sh.in +++ b/src/lib/conf.sh.in @@ -38,29 +38,30 @@ fi # Later files should take precedence over earlier files. list_files() { local slug=$1 + local sysconfdir=${_librelib_conf_sh_sysconfdir:-@sysconfdir@} case $slug in abs) - echo @sysconfdir@/$slug.conf + echo "${sysconfdir}/$slug.conf" echo "$LIBREHOME/.$slug.conf" ;; makepkg) - if [[ ${MAKEPKG_CONF:-} != @sysconfdir@/$slug.conf && -r ${MAKEPKG_CONF:-} ]]; then + if [[ ${MAKEPKG_CONF:-} != ${sysconfdir}/$slug.conf && -r ${MAKEPKG_CONF:-} ]]; then echo "$MAKEPKG_CONF" else - echo @sysconfdir@/$slug.conf + echo "${sysconfdir}/$slug.conf" echo "$LIBREHOME/.$slug.conf" fi ;; xbs*) - echo @sysconfdir@/xbs/$slug.conf + echo "${sysconfdir}/xbs/$slug.conf" echo "$XDG_CONFIG_HOME/xbs/$slug.conf" ;; libretools) - echo @sysconfdir@/$slug.conf + echo "${sysconfdir}/$slug.conf" echo "$XDG_CONFIG_HOME/libretools/$slug.conf" ;; *) - echo @sysconfdir@/libretools.d/$slug.conf + echo "${sysconfdir}/libretools.d/$slug.conf" echo "$XDG_CONFIG_HOME/libretools/$slug.conf" ;; esac diff --git a/test/testenv b/test/testenv index c1b52b0..56b56fb 100755 --- a/test/testenv +++ b/test/testenv @@ -45,10 +45,11 @@ export XBS_LIBDIR="$destdir/usr/lib/xbs" export HOME=$TMPDIR/home export XDG_CACHE_HOME="$HOME/.cache" export XDG_CONFIG_HOME="$HOME/.config" +export _librelib_conf_sh_sysconfdir="$destdir/etc" # Hack to respect our variables in sudo _sudo() { - local vars=(TMPDIR PATH LIBRETOOLS_LIBDIR XDG_CACHE_HOME XDG_CONFIG_HOME) + local vars=(TMPDIR PATH LIBRETOOLS_LIBDIR XDG_CACHE_HOME XDG_CONFIG_HOME _librelib_conf_sh_sysconfdir) local args=() local var for var in "${vars[@]}"; do -- cgit v1.2.3-54-g00ecf