Mon, 28 Jan 2013 17:37:18 +0100
Correct socket error reporting improvement with IPv6 portable code,
after helpful recommendation by Saúl Ibarra Corretgé on OSips devlist.
michael@428 | 1 | ## |
michael@428 | 2 | ## curl.sh -- OpenPKG Tools "curl" command |
michael@428 | 3 | ## Copyright (c) 2000-2012 OpenPKG GmbH <http://openpkg.com/> |
michael@428 | 4 | ## |
michael@428 | 5 | ## This software is property of the OpenPKG GmbH, DE MUC HRB 160208. |
michael@428 | 6 | ## All rights reserved. Licenses which grant limited permission to use, |
michael@428 | 7 | ## copy, modify and distribute this software are available from the |
michael@428 | 8 | ## OpenPKG GmbH. |
michael@428 | 9 | ## |
michael@428 | 10 | ## THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED |
michael@428 | 11 | ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
michael@428 | 12 | ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
michael@428 | 13 | ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR |
michael@428 | 14 | ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
michael@428 | 15 | ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
michael@428 | 16 | ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
michael@428 | 17 | ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
michael@428 | 18 | ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
michael@428 | 19 | ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT |
michael@428 | 20 | ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
michael@428 | 21 | ## SUCH DAMAGE. |
michael@428 | 22 | ## |
michael@428 | 23 | |
michael@428 | 24 | # determine path to OpenPKG instance |
michael@428 | 25 | PREFIX="${OPENPKG_PREFIX}" |
michael@428 | 26 | |
michael@428 | 27 | # determine curl and config |
michael@428 | 28 | curl="$PREFIX/lib/openpkg/curl" |
michael@428 | 29 | conf="$PREFIX/etc/openpkg/curlrc" |
michael@428 | 30 | |
michael@428 | 31 | # remove user supplied -q option (ignore ~/.curlrc) |
michael@428 | 32 | [ ".$1" = .-q ] && shift |
michael@428 | 33 | |
michael@428 | 34 | # force -q option (ignore ~/.curlrc) and -f option (error checking) |
michael@428 | 35 | set -- "-q" "-f" "$@" |
michael@428 | 36 | |
michael@428 | 37 | # prepend --config <file> option if conf file is readable |
michael@428 | 38 | declare -a a; |
michael@428 | 39 | [ -r "$conf" ] && set -- "--config" "$conf" "$@" |
michael@428 | 40 | |
michael@428 | 41 | # execute underlying application |
michael@428 | 42 | exec $curl "$@" |
michael@428 | 43 |