summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2013-05-02 22:22:21 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2013-05-02 22:22:21 -0400
commitbd1ee55dbc3f49fcdb69cc8aa6e27f20969a0591 (patch)
tree08b06e7b82d8b221177d1f106b7ea3a7e5c9236f
parentdc795bb15bd9b32912960abb217a27e9ad01cf2c (diff)
librefetch: take advantage of provided libraries
-rw-r--r--src/lib/conf.sh5
-rwxr-xr-xsrc/librefetch/librefetch31
2 files changed, 7 insertions, 29 deletions
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 <http://www.gnu.org/licenses/>.
-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 "$@"