Ports: Require less commands in .port_include.sh

- fallback to http with curl when https fails
- add --no-gpg-verification, which will skip gpg signature verification
This commit is contained in:
Peter Elliott 2021-04-10 17:01:20 -06:00 committed by Andreas Kling
parent dcee024fee
commit f71102a474

View file

@ -68,6 +68,13 @@ fetch() {
IFS=$OLDIFS
read url filename auth_sum<<< $(echo "$f")
echo "URL: ${url}"
# FIXME: Serenity's curl port does not support https, even with openssl installed.
if ! curl https://example.com -so /dev/null; then
url=$(echo "$url" | sed "s/^https:\/\//http:\/\//")
fi
# download files
if [ -f "$filename" ]; then
echo "$filename already exists"
@ -99,8 +106,12 @@ fetch() {
# extract
if [ ! -f "$workdir"/.${filename}_extracted ]; then
case "$filename" in
*.tar.gz|*.tgz)
run_nocd tar -xzf "$filename"
run touch .${filename}_extracted
;;
*.tar.gz|*.tar.bz|*.tar.bz2|*.tar.xz|*.tar.lz|.tbz*|*.txz|*.tgz)
run_nocd tar xf "$filename"
run_nocd tar -xf "$filename"
run touch .${filename}_extracted
;;
*.gz)
@ -123,6 +134,9 @@ fetch() {
# check signature
if [ "$auth_type" == "sig" ]; then
if $NO_GPG; then
echo "WARNING: gpg signature check was disabled by --no-gpg-verification"
else
if $(gpg --verify $auth_opts); then
echo "- Signature check OK."
else
@ -135,6 +149,7 @@ fetch() {
exit 1
fi
fi
fi
post_fetch
}
@ -302,6 +317,8 @@ do_all() {
do_install "${1:-}"
}
NO_GPG=false
parse_arguments() {
if [ -z "${1:-}" ]; then
do_all
else
@ -312,9 +329,17 @@ else
--auto)
do_all $1
;;
--no-gpg-verification)
NO_GPG=true
shift
parse_arguments $@
;;
*)
>&2 echo "I don't understand $1! Supported arguments: fetch, patch, configure, build, install, installdepends, clean, clean_dist, clean_all, uninstall."
exit 1
;;
esac
fi
}
parse_arguments $@