aboutsummaryrefslogtreecommitdiff
path: root/tzget
blob: bd81e4b78830d68b1ddf0cfedd6ed8ff6ec10f82 (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
#!/bin/bash

# Downloads zoneinfo files if not already present
# echos 2 lines,
# - the directory with the zoneinfo files
# - the names of the zoneinfo files to be parsed

CACHE_DIR=${CACHE_DIR:-~/.cache/calp}
RELEASE=2020a
TZ_SRC="https://github.com/eggert/tz/archive/$RELEASE.tar.gz"

mkdir -p $CACHE_DIR
cd $CACHE_DIR

test -f "$RELEASE.tar.gz" || curl -sOL $TZ_SRC
test -d "tz-$RELEASE" || tar xzf "$RELEASE.tar.gz"
cd "tz-$RELEASE"

tzpath=$(pwd)

size=$(stat -c "%s" Makefile)

cat >> Makefile << EOF
.PHONY: print-tdata
print-tdata:
	@echo \$(TDATA_TO_CHECK)
EOF
files=$(make print-tdata)

truncate -cs $size Makefile

echo $tzpath
echo $files