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
|
2021-08-31 19:01:47 +02:00
|
|
|
SIZE_ACTUAL=$(stat -c %s "$TGZ")
|
2017-02-16 19:09:54 +01:00
|
|
|
else
|
|
|
|
# Mac OS X
|
2021-08-31 19:01:47 +02:00
|
|
|
SIZE_ACTUAL=$(stat -f %z "$TGZ")
|
2017-02-16 19:09:54 +01:00
|
|
|
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
|
2021-08-31 19:01:47 +02:00
|
|
|
wget -nv --show-progress -c -O "$TGZ" "$URL"
|
2018-03-07 09:40:48 +01:00
|
|
|
else
|
2021-08-31 19:01:47 +02:00
|
|
|
curl -o "$TGZ" "$URL"
|
2018-03-07 09:40:48 +01:00
|
|
|
fi
|
2017-01-03 14:17:19 +01:00
|
|
|
fi
|