mirror of
https://github.com/rancher/os-kernel.git
synced 2025-06-24 04:37:04 +00:00
42 lines
709 B
Plaintext
42 lines
709 B
Plaintext
|
#!/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 982ecdb9d2482e06d08e6ca02d8bef8787948061 https://github.com/rancherio/linux/archive/Ubuntu-3.19.0-22.22.tar.gz
|