From bd1ee55dbc3f49fcdb69cc8aa6e27f20969a0591 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Thu, 2 May 2013 22:22:21 -0400 Subject: librefetch: take advantage of provided libraries --- src/lib/conf.sh | 5 +++++ src/librefetch/librefetch | 31 ++----------------------------- 2 files changed, 7 insertions(+), 29 deletions(-) (limited to 'src') diff --git a/src/lib/conf.sh b/src/lib/conf.sh index c5c8536..43a30af 100644 --- a/src/lib/conf.sh +++ b/src/lib/conf.sh @@ -114,3 +114,8 @@ load_conf_libretools_chroot() { check_vars chroot.conf CHROOTDIR CHROOT fi } + +load_conf_libretools_librefetch() { + load_files librefetch + check_vars librefetch.conf MIRROR DOWNLOADER +} diff --git a/src/librefetch/librefetch b/src/librefetch/librefetch index 2412db8..6a05cb9 100755 --- a/src/librefetch/librefetch +++ b/src/librefetch/librefetch @@ -18,8 +18,8 @@ # You should have received a copy of the GNU General Public License # along with Parabola. If not, see . -export TEXTDOMAIN='libretools' -export TEXTDOMAINDIR='/usr/share/locale' +. /usr/share/libretools/conf.sh +. libremessages declare -r tempdir="$(mktemp -d --tmpdir ${0##*/}.XXXXXXXXXXX)" cleanup() { rm -rf -- "$tempdir"; } @@ -296,33 +296,6 @@ print() { printf -- "$(gettext "$fmt")\n" "$@" } -# Emulates the behavior of bleeding /usr/share/libretools/conf.sh -# without requiring bleeding libretools -load_conf_libretools_librefetch() { - . /etc/libretools.d/librefetch.conf - local ret=0 - for VAR in MIRROR DOWNLOADER; do - if [[ -z ${!VAR:-} ]]; then - echo "Configure '$VAR' in /etc/libretools.d/librefetch.conf" - ret=1 - fi >>/dev/stderr - done - if [[ $ret != 0 ]]; then - return 1 - fi -} - -# From devtools common.sh, which is only distributed in a package with bleeding -# libretools -in_array() { - local needle=$1; shift - local item - for item in "$@"; do - [[ $item = $needle ]] && return 0 # Found - done - return 1 # Not Found -} - ################################################################################ main "$@" -- cgit v1.2.2