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

Ports: Remove support for algos other than sha256 and sig

This commit is contained in:
Gunnar Beutner 2021-04-25 11:54:45 +02:00 committed by Linus Groh
parent 4aaf6386ae
commit 5a3f63ea00

View file

@ -48,12 +48,6 @@ host_env() {
packagesdb="${DESTDIR}/usr/Ports/packages.db" packagesdb="${DESTDIR}/usr/Ports/packages.db"
MD5SUM=md5sum
if [ `uname -s` = "OpenBSD" ]; then
MD5SUM="md5 -q"
fi
. "$@" . "$@"
shift shift
@ -117,7 +111,7 @@ func_defined post_fetch || post_fetch() {
: :
} }
fetch() { fetch() {
if [ "$auth_type" == "sig" ] && [ ! -z "${auth_import_key}" ]; then if [ "$auth_type" = "sig" ] && [ ! -z "${auth_import_key}" ]; then
# import gpg key if not existing locally # import gpg key if not existing locally
# The default keyserver keys.openpgp.org prints "new key but contains no user ID - skipped" # The default keyserver keys.openpgp.org prints "new key but contains no user ID - skipped"
# and fails. Use a different key server. # and fails. Use a different key server.
@ -148,26 +142,18 @@ fetch() {
fi fi
fi fi
# check md5sum if given # check sha256sum if given
if [ ! -z "$auth_sum" ]; then if [ "$auth_type" = "sha256" ]; then
if [ "$auth_type" == "md5" ] || [ "$auth_type" == "sha256" ] || [ "$auth_type" == "sha1" ]; then
echo "Expecting ${auth_type}sum: $auth_sum" echo "Expecting ${auth_type}sum: $auth_sum"
if [ "$auth_type" == "md5" ]; then
calc_sum="$($MD5SUM $filename | cut -f1 -d' ')"
elif [ "$auth_type" == "sha256" ]; then
calc_sum="$(sha256sum $filename | cut -f1 -d' ')" calc_sum="$(sha256sum $filename | cut -f1 -d' ')"
elif [ "$auth_type" == "sha1" ]; then
calc_sum="$(sha1sum $filename | cut -f1 -d' ')"
fi
echo "${auth_type}sum($filename) = '$calc_sum'" echo "${auth_type}sum($filename) = '$calc_sum'"
if [ "$calc_sum" != "$auth_sum" ]; then if [ "$calc_sum" != "$auth_sum" ]; then
# remove downloaded file to re-download on next run # remove downloaded file to re-download on next run
rm -f $filename rm -f $filename
echo "${auth_type}sum's mismatching, removed erronous download. Please run script again." echo "${auth_type}sums mismatching, removed erronous download. Please run script again."
exit 1 exit 1
fi fi
fi fi
fi
# extract # extract
if [ ! -f "$workdir"/.${filename}_extracted ]; then if [ ! -f "$workdir"/.${filename}_extracted ]; then
@ -199,7 +185,7 @@ fetch() {
done done
# check signature # check signature
if [ "$auth_type" == "sig" ]; then if [ "$auth_type" = "sig" ]; then
if $NO_GPG; then if $NO_GPG; then
echo "WARNING: gpg signature check was disabled by --no-gpg-verification" echo "WARNING: gpg signature check was disabled by --no-gpg-verification"
else else