summaryrefslogtreecommitdiffstats
path: root/devtools/dev-download-and-check-release.sh
blob: d2b89a95b01714340b51f86caf5ae3a60c81a01b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# This script downloads the published versions of exa from GitHub and my site,
# checks that the checksums match, and makes sure the files at least unzip and
# execute okay.
#
# The argument should be of the form “0.8.0”, no ‘v’. That version was the
# first one to offer checksums, so it’s the minimum version that can be tested.

set +x
trap 'exit' ERR

exa_version=$1
if [[ -z "$exa_version" ]]; then
    echo "Please specify a version, such as '$0 0.8.0'"
    exit 1
fi


# Delete anything that already exists
rm -rfv "/tmp/${exa_version}-downloads"


# Create a temporary directory and download exa into it
mkdir "/tmp/${exa_version}-downloads"
cd "/tmp/${exa_version}-downloads"

echo -e "\n\033[4mDownloading stuff...\033[0m"
wget --quiet --show-progress "https://github.com/ogham/exa/releases/download/v${exa_version}/exa-macos-x86_64-${exa_version}.zip"
wget --quiet --show-progress "https://github.com/ogham/exa/releases/download/v${exa_version}/exa-linux-x86_64-${exa_version}.zip"

wget --quiet --show-progress "https://github.com/ogham/exa/releases/download/v${exa_version}/MD5SUMS"
wget --quiet --show-progress "https://github.com/ogham/exa/releases/download/v${exa_version}/SHA1SUMS"


# Unzip the zips and check the sums
echo -e "\n\033[4mExtracting that stuff...\033[0m"
unzip "exa-macos-x86_64-${exa_version}.zip"
unzip "exa-linux-x86_64-${exa_version}.zip"

echo -e "\n\033[4mValidating MD5 checksums...\033[0m"
md5sum -c MD5SUMS

echo -e "\n\033[4mValidating SHA1 checksums...\033[0m"
sha1sum -c SHA1SUMS


# Finally, give the Linux version a go
echo -e "\n\033[4mChecking it actually runs...\033[0m"
./"exa-linux-x86_64" --version
./"exa-linux-x86_64" --long

echo -e "\n\033[1;32mAll's lookin' good!\033[0m"