1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 07:37:46 +00:00

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 IFS=$OLDIFS
read url filename auth_sum<<< $(echo "$f") read url filename auth_sum<<< $(echo "$f")
echo "URL: ${url}" 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 # download files
if [ -f "$filename" ]; then if [ -f "$filename" ]; then
echo "$filename already exists" echo "$filename already exists"
@ -99,8 +106,12 @@ fetch() {
# extract # extract
if [ ! -f "$workdir"/.${filename}_extracted ]; then if [ ! -f "$workdir"/.${filename}_extracted ]; then
case "$filename" in 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) *.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 run touch .${filename}_extracted
;; ;;
*.gz) *.gz)
@ -123,16 +134,20 @@ fetch() {
# check signature # check signature
if [ "$auth_type" == "sig" ]; then if [ "$auth_type" == "sig" ]; then
if $(gpg --verify $auth_opts); then if $NO_GPG; then
echo "- Signature check OK." echo "WARNING: gpg signature check was disabled by --no-gpg-verification"
else else
echo "- Signature check NOT OK" if $(gpg --verify $auth_opts); then
for f in $files; do echo "- Signature check OK."
rm -f $f else
done echo "- Signature check NOT OK"
rm -rf "$workdir" for f in $files; do
echo " Signature mismatching, removed erronous download. Please run script again." rm -f $f
exit 1 done
rm -rf "$workdir"
echo " Signature mismatching, removed erronous download. Please run script again."
exit 1
fi
fi fi
fi fi
@ -302,19 +317,29 @@ do_all() {
do_install "${1:-}" do_install "${1:-}"
} }
if [ -z "${1:-}" ]; then NO_GPG=false
do_all parse_arguments() {
else if [ -z "${1:-}" ]; then
case "$1" in do_all
fetch|patch|configure|build|install|installdepends|clean|clean_dist|clean_all|uninstall) else
do_$1 case "$1" in
;; fetch|patch|configure|build|install|installdepends|clean|clean_dist|clean_all|uninstall)
--auto) do_$1
do_all $1 ;;
;; --auto)
*) do_all $1
>&2 echo "I don't understand $1! Supported arguments: fetch, patch, configure, build, install, installdepends, clean, clean_dist, clean_all, uninstall." ;;
exit 1 --no-gpg-verification)
;; NO_GPG=true
esac shift
fi 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 $@