fix fetch gpg key behind a proxy

add --keyserver-options when http_proxy env is set.

for docker build, need to pass http_proxy to docker

Signed-off-by: Zhang Ning <832666+zhangn1985@users.noreply.github.com>
This commit is contained in:
Zhang Ning
2019-03-12 14:44:02 +08:00
parent 5d12350e9a
commit 1c86794d01

View File

@@ -588,7 +588,11 @@ prepare_host()
# distribution packages are buggy, download from author
if [[ ! -f /etc/apt/sources.list.d/aptly.list ]]; then
display_alert "Updating from external repository" "aptly" "info"
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys ED75B5A4483DA07C >/dev/null 2>&1
if [ x"" != x$http_proxy ]; then
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --keyserver-options http-proxy=$http_proxy --recv-keys ED75B5A4483DA07C >/dev/null 2>&1
else
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys ED75B5A4483DA07C >/dev/null 2>&1
fi
echo "deb http://repo.aptly.info/ nightly main" > /etc/apt/sources.list.d/aptly.list
else
sed "s/squeeze/nightly/" -i /etc/apt/sources.list.d/aptly.list
@@ -725,7 +729,11 @@ download_toolchain()
touch $SRC/cache/.gpg/gpg.conf
chmod 600 $SRC/cache/.gpg/gpg.conf
fi
(gpg --homedir $SRC/cache/.gpg --no-permission-warning --list-keys 8F427EAF || gpg --homedir $SRC/cache/.gpg --no-permission-warning --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 8F427EAF) 2>&1 | tee -a $DEST/debug/output.log
if [ x"" != x$http_proxy ]; then
(gpg --homedir $SRC/cache/.gpg --no-permission-warning --list-keys 8F427EAF || gpg --homedir $SRC/cache/.gpg --no-permission-warning --keyserver hkp://keyserver.ubuntu.com:80 --keyserver-options http-proxy=$http_proxy --recv-keys 8F427EAF) 2>&1 | tee -a $DEST/debug/output.log
else
(gpg --homedir $SRC/cache/.gpg --no-permission-warning --list-keys 8F427EAF || gpg --homedir $SRC/cache/.gpg --no-permission-warning --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 8F427EAF) 2>&1 | tee -a $DEST/debug/output.log
fi
gpg --homedir $SRC/cache/.gpg --no-permission-warning --verify --trust-model always -q ${filename}.asc 2>&1 | tee -a $DEST/debug/output.log
[[ ${PIPESTATUS[0]} -eq 0 ]] && verified=true
else