@@ -149,11 +149,11 @@ repl() {
149
149
}
150
150
151
151
getfile () {
152
- if wget -h > /dev/null 2>&1
152
+ if wget --version > /dev/null 2>&1
153
153
then
154
154
if ! wget --no-verbose " $@ "
155
155
then
156
- error " Downloading \" $1 \" to \" ${of} \" " || return 1
156
+ error " wget --no-verbose $* " || return 1
157
157
fi
158
158
else
159
159
of=
@@ -167,17 +167,28 @@ getfile () {
167
167
if [ ${# of} -eq 0 ] ; then
168
168
of=" ${1##*/ } "
169
169
fi
170
- qecho " lynx -source \" $1 \" "
171
- # Lynx fails when it cannot access the home directory for user
172
- # configuration. Creating the home directory works this around.
173
- if [ ! -d " ${HOME} " ]
170
+ if curl --version > /dev/null 2>&1
174
171
then
175
- mkdir -p " ${HOME} "
176
- fi
177
- echo " Downloading \" $1 \" ..."
178
- if ! { lynx -source " $1 " > " ${of} " ; }
179
- then
180
- error " Downloading \" $1 \" to \" ${of} \" " || return 1
172
+ if ! curl -s -o " ${of} " " $1 "
173
+ then
174
+ error " curl -s -o \" ${of} \" \" $1 \" " || return 1
175
+ fi
176
+ else
177
+ if lynx -version > /dev/null 2>&1
178
+ then
179
+ # Lynx fails when it cannot access the home directory for user
180
+ # configuration. Creating the home directory works this around.
181
+ if [ ! -d " ${HOME} " ]
182
+ then
183
+ mkdir -p " ${HOME} "
184
+ fi
185
+ if ! { lynx -source " $1 " > " ${of} " ; }
186
+ then
187
+ error " lynx -source \" $1 \" > \" ${of} \" " || return 1
188
+ fi
189
+ else
190
+ error " No wget, lynx or curl found" || return 1
191
+ fi
181
192
fi
182
193
fi
183
194
}
@@ -232,7 +243,7 @@ find_workspace () {
232
243
get_setup () {
233
244
u=" ${mirrorsource%/ } /${arch} /setup.xz"
234
245
d=" $( cygpath -aw .) "
235
- getfile -N " ${u} "
246
+ getfile -N " ${u} " || return 1
236
247
if [ -e setup.xz ] && unxz setup.xz
237
248
then
238
249
if [ -f setup.ini ]
@@ -497,7 +508,7 @@ download () {
497
508
cd " ${cacheslash}${mirrordir} /${dn} "
498
509
if ! test -e " ${bn} " || ! echo " ${digest} ${bn} " | " ${hash} " --check ${hflags} > /dev/null 2> /dev/null
499
510
then
500
- getfile -O " ${bn} " " ${mirror%/ } /${dn} /${bn} "
511
+ getfile -O " ${bn} " " ${mirror%/ } /${dn} /${bn} " || return 1
501
512
rm -f " ${bn} .unpacked"
502
513
echo " $digest $bn " | " ${hash} " --check ${hflags} > /dev/null 2> /dev/null \
503
514
|| error " Hash ${hash} of ${cacheslash}${mirrordir} /${dn} /${bn} did not result in ${digest} " || return 1
@@ -535,7 +546,7 @@ apt_searchall () {
535
546
for pkg in $pks
536
547
do
537
548
qs=" text=1&arch=${arch} &grep=${pkg} "
538
- getfile -O " /tmp/matches$$ .txt" " http://cygwin.com/cgi-bin2/package-grep.cgi?$qs "
549
+ getfile -O " /tmp/matches$$ .txt" " http://cygwin.com/cgi-bin2/package-grep.cgi?$qs " || return 1
539
550
awk '
540
551
NR == 1 {next}
541
552
mc[$1]++ {next}
0 commit comments