Skip to content

Commit 5f53f81

Browse files
committed
adapt download script for signed textfiles
1 parent 4c9ab69 commit 5f53f81

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

10-fetch-current-stage3-from-gentoo.sh

+13-2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ prepare_directories() {
1818
download_variant() {
1919
local Arch=$1
2020
local Variant=$2
21+
local Tmpfile=$(mktemp)
2122

2223
case $Arch in
2324
x86) FArch=i686;;
@@ -37,9 +38,19 @@ download_variant() {
3738
echo "cannot download $Arch $Variant - HTTP Returncode is $HTTPCODE"
3839
exit 100
3940
fi
40-
FILE=$(curl --location "https://bouncer.gentoo.org/fetch/root/all/releases/$Arch/autobuilds/latest-stage3-$FArch-$Variant.txt" | sed '/^#/d' | cut -f1 -d" " )
41+
curl --location "https://bouncer.gentoo.org/fetch/root/all/releases/$Arch/autobuilds/latest-stage3-$FArch-$Variant.txt" --output $Tmpfile
42+
# check if file is GPG signed
43+
local FirstLine=$(head -n1 $Tmpfile)
44+
if [ "$FirstLine" = "-----BEGIN PGP SIGNED MESSAGE-----" ]
45+
then
46+
echo "download done, GPG check:"
47+
mv "$Tmpfile" "${Tmpfile}-s"
48+
gpg --output "$Tmpfile" --verify "${Tmpfile}-s"
49+
rm -f "${Tmpfile}-s"
50+
fi
51+
FILE=$(cat $Tmpfile | sed '/^#/d' | cut -f1 -d" " )
4152
FILEPATH="https://bouncer.gentoo.org/fetch/root/all/releases/$Arch/autobuilds/$FILE"
42-
53+
rm -f "${Tmpfile}"
4354
echo "Download URL: $FILEPATH"
4455
pause
4556
curl --remote-name --location --continue-at - "$FILEPATH" && echo "Download successful."

0 commit comments

Comments
 (0)