]>
git.saurik.com Git - apple/system_cmds.git/blob - zic.tproj/generate_zoneinfo.sh
8 echo "Usage: $0 SRCROOT OBJROOT BUILT_PRODUCTS_DIR SDKROOT PLATFORM_NAME" 1>&2
14 BUILT_PRODUCTS_DIR
="$3"
18 ZICHOST_SYMROOT
="${BUILT_PRODUCTS_DIR}/zic_host-sym"
19 ZICHOST_DSTROOT
="${BUILT_PRODUCTS_DIR}/zic_host-dst"
20 ZICHOST
="${ZICHOST_DSTROOT}/zic_host"
22 LOCALTIME
="US/Pacific"
23 POSIXRULES
="US/Pacific"
25 ZONEINFO
="${BUILT_PRODUCTS_DIR}/zoneinfo"
26 DATFILES
="${BUILT_PRODUCTS_DIR}/datfiles"
27 PRIVATEDIR
="${BUILT_PRODUCTS_DIR}/private"
29 # ftp://elsie.nci.nih.gov/pub/tzdata*.tar.gz
30 # the tzdata*.tar.gz file is automatically unpacked and a version file created
31 # /usr/local/share/tz/tzdata*.tar.gz is installed by the TimeZoneData project
32 TARBALL
="${SDKROOT}"/usr
/local
/share
/tz
/latest_tzdata.
tar.gz
33 if [ ! -L "$TARBALL" ]; then
34 echo "error: ${TARBALL} is not a symbolic link" 1>&2
37 if [ ! -r "$TARBALL" ]; then
38 echo "error: ${TARBALL} does not point to a valid file" 1>&2
41 DATVERS
=`readlink ${TARBALL} | cut -d. -f1 | sed -e 's/^tzdata//'`
42 VERSIONFILE
="${ZONEINFO}/+VERSION"
44 mkdir -p "${DATFILES}"
45 mkdir -p "${ZONEINFO}"
46 tar zxf
"${TARBALL}" -C "${DATFILES}"
47 ZONE_FILES
="$("${SRCROOT}"/zic.tproj/generate_zone_file_list.sh "${DATFILES}")"
48 for tz
in ${ZONE_FILES}; do
49 if [ ${tz} = "northamerica" ]; then
50 ARG
="-p America/New_York"
54 "${ZICHOST}" ${ARG} -L /dev
/null
-d "${ZONEINFO}" \
55 -y "${DATFILES}/yearistype.sh" "${DATFILES}/${tz}" || exit 1
62 chmod -R og
-w "${ZONEINFO}"
63 for f
in "zone.tab" "iso3166.tab"; do
64 install -m 0444 "${DATFILES}/$f" "${ZONEINFO}/$f" || exit 1
70 if [ -n "$RC_BRIDGE" ]; then
71 ACTUAL_PLATFORM_NAME
="bridge${PLATFORM_NAME#watch}"
73 ACTUAL_PLATFORM_NAME
="${PLATFORM_NAME}"
76 case "$ACTUAL_PLATFORM_NAME" in
77 iphone
*|appletv
*|watch
*)
78 mkdir -p "${PRIVATEDIR}/var/db"
79 mkdir -p -m a
+rx
"${PRIVATEDIR}/var/db/timezone"
81 # This link must precisely start with TZDIR followed by a slash. radar:13532660
82 ln -hfs "/var/db/timezone/zoneinfo/${LOCALTIME}" "${PRIVATEDIR}/var/db/timezone/localtime"
85 mkdir -p "${PRIVATEDIR}/etc"
86 ln -hfs "/usr/share/zoneinfo/${LOCALTIME}" "${PRIVATEDIR}/etc/localtime"
89 echo "Unsupported platform: $ACTUAL_PLATFORM_NAME"
94 rm -f "${VERSIONFILE}"
95 echo ${DATVERS} > "${VERSIONFILE}"
96 chmod 444 "${VERSIONFILE}"