ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/ozone/mgar/gar/bin/ozsw-fetch
Revision: 1
Committed: Sat Jun 20 14:58:51 2026 UTC (4 weeks, 3 days ago) by operz
File size: 1002 byte(s)
Log Message:
Initial import of OZSW mgar build tree

File Contents

# Content
1 #!/bin/sh
2 # ozsw-fetch - wget-compatible fetch wrapper using /opt/oz/bin/curl
3 # Understands: -T timeout -c (continue) -P dir URL
4 # Used by gar.lib.mk fetch rules via WGET variable.
5 # Note: wget's -T is connection timeout only; we use --connect-timeout
6 # and leave --max-time unlimited so large files don't get cut off.
7
8 CURL=/opt/oz/bin/curl
9 CONNECT_TIMEOUT=30
10 PARTIAL_DIR=.
11 URL=
12 CONTINUE=
13
14 while [ $# -gt 0 ]; do
15 case "$1" in
16 -T) CONNECT_TIMEOUT="$2"; shift 2 ;;
17 -T*) CONNECT_TIMEOUT="${1#-T}"; shift ;;
18 -c) CONTINUE="-C -"; shift ;;
19 -P) PARTIAL_DIR="$2"; shift 2 ;;
20 --*) shift ;;
21 -*) shift ;;
22 *) URL="$1"; shift ;;
23 esac
24 done
25
26 if [ -z "$URL" ]; then
27 echo "ozsw-fetch: no URL given" >&2
28 exit 1
29 fi
30
31 FILE=$(basename "$URL")
32 DEST="$PARTIAL_DIR/$FILE"
33
34 exec "$CURL" \
35 --connect-timeout "$CONNECT_TIMEOUT" \
36 --retry 3 \
37 --retry-delay 5 \
38 --location \
39 --fail \
40 --output "$DEST" \
41 ${CONTINUE} \
42 "$URL"

Properties

Name Value
svn:executable *