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