-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate.sh
More file actions
executable file
·49 lines (40 loc) · 1.24 KB
/
update.sh
File metadata and controls
executable file
·49 lines (40 loc) · 1.24 KB
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
#!/bin/bash
# This script rebuilds the timezone data files using files
# downloaded from the IANA distribution.
#
# Usage:
# ./update.sh # download, compile, and package tzdata
# ./update.sh -work # same but keep the work directory
# Versions to use.
CODE=2026a
DATA=2026a
set -e
cd "$(dirname "$0")"
rm -rf work
mkdir work
go build -o work/mkzip mkzip.go
cd work
mkdir zoneinfo
curl -sS -L -O "https://data.iana.org/time-zones/releases/tzcode${CODE}.tar.gz"
curl -sS -L -O "https://data.iana.org/time-zones/releases/tzdata${DATA}.tar.gz"
tar xzf "tzcode${CODE}.tar.gz"
tar xzf "tzdata${DATA}.tar.gz"
# Compile timezone data using zic.
# PACKRATDATA=backzone includes historical timezone data.
# PACKRATLIST=zone.tab includes all zones.
if ! make CFLAGS=-DSTD_INSPIRED AWK=awk TZDIR=zoneinfo PACKRATDATA=backzone PACKRATLIST=zone.tab posix_only >make.out 2>&1; then
cat make.out
exit 2
fi
# Copy metadata files into the zoneinfo directory for inclusion in the zip.
cp zone1970.tab iso3166.tab zoneinfo/
# Package compiled TZif files into a zip.
cd zoneinfo
../mkzip ../../zoneinfo.zip
cd ../..
echo "Updated zoneinfo.zip for tzcode${CODE}/tzdata${DATA}"
if [ "$1" = "-work" ]; then
echo "Left workspace behind in work/."
else
rm -rf work
fi