1#!/bin/bash 2 3set +e 4set -o xtrace 5 6# if we run this script outside of gitlab-ci for testing, ensure 7# we got meaningful variables 8CI_PROJECT_DIR=${CI_PROJECT_DIR:-$(mktemp -d)/mesa} 9 10if [[ -e $CI_PROJECT_DIR/.git ]] 11then 12 echo "Repository already present, skip cache download" 13 exit 14fi 15 16TMP_DIR=$(mktemp -d) 17 18echo "Downloading archived master..." 19/usr/bin/wget -O $TMP_DIR/mesa.tar.gz \ 20 https://minio-packet.freedesktop.org/git-cache/mesa/mesa/mesa.tar.gz 21 22# check wget error code 23if [[ $? -ne 0 ]] 24then 25 echo "Repository cache not available" 26 exit 27fi 28 29set -e 30 31rm -rf "$CI_PROJECT_DIR" 32echo "Extracting tarball into '$CI_PROJECT_DIR'..." 33mkdir -p "$CI_PROJECT_DIR" 34tar xzf "$TMP_DIR/mesa.tar.gz" -C "$CI_PROJECT_DIR" 35rm -rf "$TMP_DIR" 36chmod a+w "$CI_PROJECT_DIR" 37