Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


Hi all,

I've recently been bitten by the 'download' script, which was
unable to use curl, even tough it is in my $PATH.

The attached patch replaces the strange and broken lookup logic
present in the script by a single 'which' command.

If there is no objection, I'll push this patch in a few days.

-- 
Francois Tigeot
From ccc4b3e16e35fa1414fe70105f542d5ec77902a0 Mon Sep 17 00:00:00 2001
From: Francois Tigeot <ftigeot@wolfpond.org>
Date: Sat, 26 Mar 2011 23:25:40 +0100
Subject: [PATCH] Use the default PATH to find the curl executable.

The previous code was trying to pick up the full curl path in a harcoded
list of places and actually failed to locate binaries on some hosts, even
though they were present in $PATH .
---
 download |   15 +--------------
 1 files changed, 1 insertions(+), 14 deletions(-)

diff --git a/download b/download
index 578f26d..f325c4c 100755
--- a/download
+++ b/download
@@ -66,7 +66,7 @@ fi
 # check for wget and md5sum
 wget=
 md5sum=
-curl=
+curl=`which curl`
 
 for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/wget 
/opt/local/bin/wget; do
     eval "$i --version" > /dev/null 2>&1
@@ -77,19 +77,6 @@ for i in wget /usr/bin/wget /usr/local/bin/wget /usr/sfw/bin/wget /opt/sfw/bin/w
     fi
 done
 
-if [ -z "$wget" ]; then
-    for i in curl /usr/bin/curl /usr/local/bin/curl /usr/sfw/bin/curl /opt/sfw/bin/curl 
/opt/local/bin/curl; do
-    # mac curl returns "2" on --version 
-    #    eval "$i --version" > /dev/null 2>&1
-    #    ret=$?
-    #    if [ $ret -eq 0 ]; then
-        if [ -x $i ]; then
-            curl=$i
-            break
-        fi
-    done
-fi
-
 if [ -z "$wget" -a -z "$curl" ]; then
     echo "ERROR: neither  wget nor curl found!"
     exit 1
-- 
1.7.3.4


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.