mirror of
https://github.com/scummvm/dockerized-bb.git
synced 2026-06-20 05:46:00 +00:00
COMMON: Enhance verification process to handle more methods
This commit is contained in:
@@ -22,6 +22,42 @@ __do_patch () {
|
||||
fi
|
||||
}
|
||||
|
||||
# This function is a private helper and should not be unprefixed
|
||||
__do_verify () {
|
||||
local hsh
|
||||
|
||||
if [ -z "$2" ]; then
|
||||
# No verification method
|
||||
return
|
||||
fi
|
||||
|
||||
case $2 in
|
||||
'gpgurl:'*)
|
||||
wget --no-hsts --progress=dot "${2#gpgurl:}" -O "$1.sig"
|
||||
if gpg --verify "$1.sig" "$1"; then
|
||||
return
|
||||
fi
|
||||
;;
|
||||
'sha1:'*)
|
||||
hsh=$(sha1sum "$1" |cut -f1 -d' ')
|
||||
if [ "$hsh" = "${2#sha1:}" ]; then
|
||||
return
|
||||
fi
|
||||
;;
|
||||
'sha256:'*)
|
||||
hsh=$(sha256sum "$1" |cut -f1 -d' ')
|
||||
if [ "$hsh" = "${2#sha256:}" ]; then
|
||||
return
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
error "Verification method not supported: $2"
|
||||
;;
|
||||
esac
|
||||
|
||||
error "BUG"
|
||||
}
|
||||
|
||||
__do_pkg_fetch () {
|
||||
if [ -d "$1"*/ ]; then
|
||||
rm -rf "$1"*/
|
||||
@@ -41,12 +77,8 @@ __do_http_fetch () {
|
||||
fname=$(basename $2)
|
||||
wget --no-hsts --progress=dot "$2" -O "$fname"
|
||||
|
||||
if [ -n "$4" ]; then
|
||||
wget --no-hsts --progress=dot "$4" -O "$fname.sig"
|
||||
if ! gpg --verify "$fname.sig" "$fname"; then
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
__do_verify "$fname" "$4"
|
||||
|
||||
$3 "$fname"
|
||||
cd "$1"*/
|
||||
do_patch
|
||||
|
||||
@@ -10,7 +10,7 @@ do_make_bdir
|
||||
|
||||
# GPG key of Sam Lantinga
|
||||
gpg --keyserver hkps://hkps.pool.sks-keyservers.net --recv-keys 0xA7763BE6
|
||||
do_http_fetch SDL2 'https://www.libsdl.org/release/SDL2-2.0.10.tar.gz' 'tar xzf' 'https://www.libsdl.org/release/SDL2-2.0.10.tar.gz.sig'
|
||||
do_http_fetch SDL2 'https://www.libsdl.org/release/SDL2-2.0.10.tar.gz' 'tar xzf' 'gpgurl:https://www.libsdl.org/release/SDL2-2.0.10.tar.gz.sig'
|
||||
rm -Rf $HOME/.gnupg
|
||||
|
||||
do_configure --enable-shared --disable-static
|
||||
|
||||
Reference in New Issue
Block a user