#!/bin/sh
set -e
upstream_version=10.8.6
file="master.zip"
url="https://github.com/phoronix-test-suite/phoronix-test-suite/archive/refs/heads/${file}"
download_path="/tmp/phoronix-test-suite-${upstream_version}.zip"

if [ "$1" = "configure" ]; then

    [ -f "${download_path}" ] && rm -rf "${download_path}"

    wget --show-progress -O "${download_path}" "$url"

    echo "Extracting phoronix-test-suite ${upstream_version}..."
    unzip -qq "${download_path}" -d /tmp
    cd /tmp/phoronix-test-suite-master/
    ./install-sh
    rm -Rf "${download_path}"
    rm -Rf /tmp/phoronix-test-suite-master/
fi

