github.com/mundipagg/boleto-api@v0.0.0-20230620145841-3f9ec742599f/devops/time/update.bash (about)

     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  
     6  # This script rebuilds the time zone files using files
     7  # downloaded from the ICANN/IANA distribution.
     8  # Consult https://www.iana.org/time-zones for the latest versions.
     9  
    10  # Versions to use.
    11  CODE=2019b
    12  DATA=2019b
    13  
    14  set -e
    15  rm -rf work
    16  mkdir work
    17  cd work
    18  mkdir zoneinfo
    19  curl -L -O https://www.iana.org/time-zones/repository/releases/tzcode$CODE.tar.gz
    20  curl -L -O https://www.iana.org/time-zones/repository/releases/tzdata$DATA.tar.gz
    21  tar xzf tzcode$CODE.tar.gz
    22  tar xzf tzdata$DATA.tar.gz
    23  
    24  make CFLAGS=-DSTD_INSPIRED AWK=awk TZDIR=zoneinfo posix_only
    25  
    26  cd zoneinfo
    27  rm -f ../../zoneinfo.zip
    28  zip -0 -r ../../zoneinfo.zip *
    29  cd ../..
    30  
    31  echo
    32  if [ "$1" = "-work" ]; then
    33  	echo Left workspace behind in work/.
    34  else
    35  	rm -rf work
    36  fi
    37  echo New time zone files in zoneinfo.zip.