File: download-ucd-files.sh

package info (click to toggle)
haskell-unicode-transforms 0.4.0.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,312 kB
  • sloc: haskell: 786; sh: 15; makefile: 7
file content (29 lines) | stat: -rw-r--r-- 921 bytes parent folder | download | duplicates (2)
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
#!/bin/sh

# When reproducing the Haskell files we want to to be sure that the files that
# we used to generate them earlier are exactly the same as the ones we are
# downloading. To ensure that verfication of the checksum is necessary.

VERSION=14.0.0

SRC_FILE="https://www.unicode.org/Public/$VERSION/ucd/NormalizationTest.txt"
DST_FILE="test/data/NormalizationTest.txt"
SRC_FILE_CKSUM="7cb30cc2abe6c29c292b99095865d379ce1213045c78c4ff59c7e9391bbe2331"


# Download the file
wget -O "$DST_FILE" "$SRC_FILE"

# Verify checksum
DST_FILE_CKSUM=$(sha256sum $DST_FILE | cut -f1 -d' ')
if test "$DST_FILE_CKSUM" != "$SRC_FILE_CKSUM"
then
    echo "sha256sum of the downloaded file $DST_FILE "
    echo "   [$DST_FILE_CKSUM] does not match the expected checksum [$SRC_FILE_CKSUM]"
    exit 1
else
    echo "$DST_FILE checksum ok"
fi

# Export the version so it can be used by the executable
export UNICODE_VERSION="$VERSION"