Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
alpine
abuild
Commits
df05d495
Commit
df05d495
authored
Dec 16, 2011
by
Natanael Copa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
abuild: use curl by default. fallback to wget if curl is missing
fixes
#871
parent
ff53e776
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
6 deletions
+27
-6
abuild.in
abuild.in
+27
-6
No files found.
abuild.in
View file @
df05d495
...
...
@@ -236,11 +236,26 @@ sourcecheck() {
return
0
}
# convert curl options to wget options and call wget instead of curl
wget_fallback
()
{
local
wget_opts
=
outfile
=
opt
=
while
getopts
"C:ko:s"
opt
;
do
case
$opt
in
'C'
)
wget_opts
=
"
$wget_opts
-c"
;;
# --continue-at
's'
)
wget_opts
=
"
$wget_opts
-q"
;;
# --silent
'o'
)
wget_opts
=
"
$wget_opts
-O
$OPTARG
"
;;
# --output
'k'
)
wget_opts
=
"
$wget_opts
--no-check-certificate"
;;
#gnu wget
esac
done
shift
$((
$OPTIND
-
1
))
wget
$wget_opts
"
$1
"
}
uri_fetch
()
{
local
uri
=
"
$1
"
local
d
=
"
${
uri
##*/
}
"
# $(basename $uri)
local
opts
[
-n
"
$quiet
"
]
&&
opts
=
"-
q
"
[
-n
"
$quiet
"
]
&&
opts
=
"-
s
"
[
-f
"
$SRCDEST
/
$d
"
]
&&
return
0
# fix saveas-*://* URIs
...
...
@@ -250,18 +265,24 @@ uri_fetch() {
saveas-
*
://
*
)
uri
=
"
${
uri
:7:
$(
expr
${#
uri
}
- 7 -
${#
d
}
- 1
)
}
"
;;
esac
# we need GNU wget for this
case
"
$uri
"
in
https://
*
)
opts
=
"-
-no-check-certificate
"
;;
https://
*
)
opts
=
"-
k
"
;;
esac
mkdir
-p
"
$SRCDEST
"
if
[
-f
"
$SRCDEST
/
$d
.part"
]
;
then
msg
"Partial download found. Trying to resume"
opts
=
"
$opts
-
c
"
opts
=
"
$opts
-
C -
"
fi
msg
"Fetching
$uri
"
wget
$opts
-O
"
$SRCDEST
/
$d
.part"
"
$uri
"
\
# fallback to wget if curl is missing. useful for bootstrapping
local
fetcher
=
curl
if
!
[
-x
"
$(
which curl
)
"
]
;
then
fetcher
=
wget_fallback
fi
$fetcher
$opts
-o
"
$SRCDEST
/
$d
.part"
"
$uri
"
\
&&
mv
"
$SRCDEST
/
$d
.part"
"
$SRCDEST
/
$d
"
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment