1
0
mirror of https://github.com/rancher/os-kernel.git synced 2025-07-10 20:13:06 +00:00
os-kernel/scripts/download
Sven Dowideit 62bdf18b9d os-extras and os-headers images are built for release/ci
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
2016-11-14 21:48:51 +10:00

43 lines
650 B
Bash
Executable File

#!/bin/bash
set -e
set -x
cd $(dirname $0)/..
source scripts/build-common
check()
{
local hash=$1
local file=$2
if [ ! -e "$file" ]; then
return 1
fi
CURRENT=$(sha1sum $file | awk '{print $1}')
[ "$hash" = "$CURRENT" ]
}
download()
{
mkdir -p ${ARTIFACTS}
local url=$2
local file=${ARTIFACTS}/$(basename $2)
local hash=$1
if ! check $hash $file; then
curl -sL $url > $file
fi
if ! check $hash $file; then
echo "ERROR: $file does not match checksum $hash, got $CURRENT" 1>&2
return 1
fi
}
# Download Kernel source
download ${KERNEL_SHA1} ${KERNEL_URL}