summaryrefslogtreecommitdiff
path: root/pkg/tz/tzdata.awk
blob: e7b4808531795c4befec1c6993d7ad37a9931fb1 (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
# usage: awk -f tzdata.awk repo=out/root.git out=out/pkg/tz/zoneinfo [file...]

function run(cmd) {
	status = system(cmd)
	if (status != 0)
		exit status
}

BEGIN {
	cmdfmt = "rc ./scripts/hash.rc %s %s share/zoneinfo/%s %s"
}

FNR == 1 {
	run(sprintf("zic -d %s %s", out, FILENAME))
}

$1 == "Link" {
	s = $3
	gsub(/[^\/]+/, "..", s)
	s = substr(s, 1, length(s) - 2) $2
	run(sprintf(cmdfmt, repo, 120000, $3, s))
}

$1 == "Zone" {
	run(sprintf(cmdfmt, repo, 100644, $2, out "/" $2))
}