vmtests: harden fetching kernel sources

Ensure that corrupted tar archive won't screw up build.

Signed-off-by: Andrii Nakryiko <andriin@fb.com>
This commit is contained in:
Andrii Nakryiko
2020-08-21 15:44:45 -07:00
committed by Andrii Nakryiko
parent 28e26bdc3e
commit 63c78982c7

View File

@@ -17,8 +17,7 @@ if [ ! -d "${REPO_PATH}" ]; then
mkdir -p $(dirname "${REPO_PATH}")
cd $(dirname "${REPO_PATH}")
# attempt to fetch desired bpf-next repo snapshot
if wget ${SNAPSHOT_URL} ; then
tar xf bpf-next-${LINUX_SHA}.tar.gz
if wget ${SNAPSHOT_URL} && tar xf bpf-next-${LINUX_SHA}.tar.gz ; then
mv bpf-next-${LINUX_SHA} $(basename ${REPO_PATH})
else
# but fallback to git fetch approach if that fails