-
-
Save Manuel-Cano-Olivares/72ec349ad60f3f35f67b0004aab1e333 to your computer and use it in GitHub Desktop.
Update tzdata and ICU data on OS X to fix problems with outdated DST information (needs reboot)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # author: Tomás Girardi | |
| # Based on http://helw.net/2011/04/28/updating-osx-for-egypts-dst-changes/ by Ahmed El-Helw | |
| # Actualizado por Manuel Cano | |
| # Cambios: url de tzdata (URLTZDATASRC), url de icu4c (y soporte al cambio de respuesta de S3, y a las posibles release (hasta 4)) | |
| # | |
| # Probado con exito en mi Macbook Pro con Yosemite en junio de 2020 | |
| # CHANGE THIS: SOLO SI ES NECESARIO | |
| # go to https://www.iana.org/time-zones and get the URL for the last DATA | |
| # release | |
| URLTZDATASRC=https://www.iana.org/time-zones/repository/tzdata-latest.tar.gz | |
| # BACKUP your current icu file first | |
| cp /usr/share/icu/*.dat ~ | |
| ICUVERSION=`ls /usr/share/icu/*.dat | grep -o "\(\d\d\)l\.dat" | grep -o "^\d\d"` | |
| URLICUSRC="https://github.com/unicode-org/icu/releases/download/release-${ICUVERSION}-NNN/icu4c-${ICUVERSION}_NNN-src.tgz" | |
| # NNN es subversion, usar la misma sintaxis si se cambia la URL | |
| # antigua url "http://download.icu-project.org/files/icu4c/${ICUVERSION}.1/icu4c-${ICUVERSION}_1-src.zip" | |
| ### update tzdata | |
| cd /tmp | |
| mkdir tzdata | |
| cd tzdata | |
| wget "${URLTZDATASRC}" | |
| tar -xzf tzdata-latest.tar.gz | |
| sudo zic africa | |
| sudo zic antarctica | |
| sudo zic asia | |
| sudo zic australasia | |
| sudo zic backward | |
| sudo zic etcetera | |
| sudo zic europe | |
| sudo zic factory | |
| sudo zic northamerica | |
| sudo zic pacificnew | |
| sudo zic southamerica | |
| sudo zic systemv | |
| ### update ICU data | |
| cd /tmp | |
| mkdir icu4c | |
| cd icu4c | |
| #wget "${URLICUSRC}" -O icusrc.tar.gz | |
| URL="${URLICUSRC//NNN/1}" | |
| echo "intentando descargar $URL" | |
| if wget -S --spider $URL 2>&1 | grep -q '302 Found'; then | |
| wget "${URL}" -O icusrc.tar.gz | |
| else | |
| URL="${URLICUSRC//NNN/2}" | |
| echo "intentando descargar $URL" | |
| if wget -S --spider $URL 2>&1 | grep -q '302 Found'; then | |
| wget "${URL}" -O icusrc.tar.gz | |
| else | |
| URL="${URLICUSRC//NNN/3}" | |
| echo "intentando descargar $URL" | |
| if wget -S --spider $URL 2>&1 | grep -q '302 Found'; then | |
| wget "${URL}" -O icusrc.tar.gz | |
| else | |
| URL="${URLICUSRC//NNN/4}" | |
| echo "intentando descargar $URL" | |
| if wget -S --spider $URL 2>&1 | grep -q '302 Found'; then | |
| wget "${URL}" -O icusrc.tar.gz | |
| else | |
| echo 'Url $URL no existe!' | |
| return | |
| fi | |
| fi | |
| fi | |
| fi | |
| tar xzf icusrc.tar.gz | |
| cd icu/source/tools/tzcode | |
| # ./icuSources/tools/tzcode/readme.txt tells us that placing a tzdata | |
| # file in the tzcode directory will compile with that zoneinfo database | |
| # download latest tzdata | |
| wget "${URLTZDATASRC}" | |
| cd ../.. | |
| # compile | |
| ./runConfigureICU MacOSX --with-data-packaging=archive | |
| gnumake | |
| # replace the data file only | |
| sudo install -o root -g wheel -m 0644 -Sp "data/out/icudt${ICUVERSION}l.dat" "/usr/share/icu/icudt${ICUVERSION}l.dat" | |
| # NOW REBOOT!!! |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Probado con éxito en mi Macbook Pro con Yosemite en junio de 2020