1
0
mirror of https://github.com/rancher/os-kernel.git synced 2025-07-07 10:38:36 +00:00
os-kernel/scripts/download
2015-08-07 16:59:58 +05:00

42 lines
707 B
Bash
Executable File

#!/bin/bash
set -e
set -x
cd $(dirname $0)/..
: ${ARTIFACTS:=$(pwd)/assets}
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 8fa49a10cd67393b524793a52e7abbdcae1ee4cc https://github.com/rancher/linux/archive/Ubuntu-3.19.0-26.27.tar.gz