2017-01-03 14:17:19 +01:00
|
|
|
#!/bin/bash -eu
|
|
|
|
#
|
2017-01-03 14:33:55 +01:00
|
|
|
# This script checks the size of /tmp/linux-3.0.tar.gz and downloads
|
|
|
|
# a fresh copy if the size is incorrect or the file is missing.
|
2017-01-03 14:17:19 +01:00
|
|
|
|
2018-03-07 09:40:48 +01:00
|
|
|
URL=https://cdn.kernel.org/pub/linux/kernel/v3.0/linux-3.0.tar.gz
|
2017-01-03 14:17:19 +01:00
|
|
|
TGZ=/tmp/linux-3.0.tar.gz
|
|
|
|
|
2017-01-03 14:33:55 +01:00
|
|
|
SIZE_WANT=96675825
|
|
|
|
SIZE_ACTUAL=0
|
|
|
|
if [[ -e $TGZ ]]; then
|
2017-02-16 19:09:54 +01:00
|
|
|
if [[ $OSTYPE == linux* ]] ; then
|
|
|
|
SIZE_ACTUAL=$(stat -c %s $TGZ)
|
|
|
|
else
|
|
|
|
# Mac OS X
|
|
|
|
SIZE_ACTUAL=$(stat -f %z $TGZ)
|
|
|
|
fi
|
2017-01-03 14:33:55 +01:00
|
|
|
fi
|
2017-01-03 14:17:19 +01:00
|
|
|
|
2017-01-03 14:33:55 +01:00
|
|
|
if [[ $SIZE_ACTUAL -ne $SIZE_WANT ]]; then
|
2017-01-03 14:17:19 +01:00
|
|
|
echo "Downloading linux-3.0.tar.gz"
|
2018-03-07 09:40:48 +01:00
|
|
|
if command -v wget > /dev/null ; then
|
|
|
|
wget -nv --show-progress -c -O $TGZ $URL
|
|
|
|
else
|
|
|
|
curl -o $TGZ $URL
|
|
|
|
fi
|
2017-01-03 14:17:19 +01:00
|
|
|
fi
|