#!/usr/bin/env bash # Makes this folder afresh from IANA's latest time zone release: each zone # of zone.tab compiled by zic (slim TZif, rules to come in its footer), # UTC, and `zones`, the list Settings offers. Needs curl and zic. set -euo pipefail here="$(cd "$(dirname "$0")" && pwd)" work="$(mktemp -d)" trap 'rm -rf "$work"' EXIT cd "$work" curl -sSfLO https://data.iana.org/time-zones/tzdata-latest.tar.gz tar xzf tzdata-latest.tar.gz zic -b slim -d out africa antarctica asia australasia europe northamerica southamerica etcetera backward find "$here" -mindepth 1 -maxdepth 1 -type d -exec rm -rf {} + rm -f "$here/UTC" "$here/zones" "$here/version" # Each zone: name and country, sorted by name. grep -v '^#' zone.tab | while IFS=$'\t' read -r code _ name _; do country="$(awk -F'\t' -v c="$code" '$1 == c { print $2 }' iso3166.tab)" printf '%s\t%s\n' "$name" "$country" done | LC_ALL=C sort > "$here/zones" cut -f1 "$here/zones" | while read -r name; do mkdir -p "$here/$(dirname "$name")" cp "out/$name" "$here/$name" done cp out/Etc/UTC "$here/UTC" cp version "$here/version" echo "zoneinfo: $(cat version), $(wc -l < "$here/zones") zones"