update.bash 952 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/bin/bash
  2. # Copyright 2012 The Go Authors. All rights reserved.
  3. # Use of this source code is governed by a BSD-style
  4. # license that can be found in the LICENSE file.
  5. # This script rebuilds the time zone files using files
  6. # downloaded from the ICANN/IANA distribution.
  7. # Consult https://www.iana.org/time-zones for the latest versions.
  8. # Versions to use.
  9. CODE=2021e
  10. DATA=2021e
  11. set -e
  12. rm -rf work
  13. mkdir work
  14. cd work
  15. mkdir zoneinfo
  16. curl -L -O https://www.iana.org/time-zones/repository/releases/tzcode$CODE.tar.gz
  17. curl -L -O https://www.iana.org/time-zones/repository/releases/tzdata$DATA.tar.gz
  18. tar xzf tzcode$CODE.tar.gz
  19. tar xzf tzdata$DATA.tar.gz
  20. make CFLAGS=-DSTD_INSPIRED AWK=awk TZDIR=zoneinfo posix_only
  21. cd zoneinfo
  22. rm -f ../../zoneinfo.zip
  23. zip -0 -r ../../zoneinfo.zip *
  24. cd ../..
  25. go generate time/tzdata
  26. echo
  27. if [ "$1" = "-work" ]; then
  28. echo Left workspace behind in work/.
  29. else
  30. rm -rf work
  31. fi
  32. echo New time zone files in zoneinfo.zip.