]> git.saurik.com Git - apple/system_cmds.git/blobdiff - zic.tproj/generate_zoneinfo.sh
system_cmds-735.20.1.tar.gz
[apple/system_cmds.git] / zic.tproj / generate_zoneinfo.sh
index 9859ae85c021e44b2e3691c88591c1c73f47c3c5..16484d1b86bcd3a4777ebaf4618b28fe572d657c 100755 (executable)
@@ -22,8 +22,6 @@ ZICHOST="${ZICHOST_DSTROOT}/zic_host"
 LOCALTIME="US/Pacific"
 POSIXRULES="US/Pacific"
 
-# pacificnew is obsolete and was removed from ZONE_FILES
-ZONE_FILES="africa antarctica asia australasia europe northamerica southamerica etcetera factory backward systemv"
 ZONEINFO="${BUILT_PRODUCTS_DIR}/zoneinfo"
 DATFILES="${BUILT_PRODUCTS_DIR}/datfiles"
 PRIVATEDIR="${BUILT_PRODUCTS_DIR}/private"
@@ -31,26 +29,32 @@ PRIVATEDIR="${BUILT_PRODUCTS_DIR}/private"
 # ftp://elsie.nci.nih.gov/pub/tzdata*.tar.gz
 # the tzdata*.tar.gz file is automatically unpacked and a version file created
 # /usr/local/share/tz/tzdata*.tar.gz is installed by the TimeZoneData project
-TARBALL=`ls ${SDKROOT}/usr/local/share/tz/tzdata* | sort | tail -n 1`
-if [ -z "$TARBALL" ]; then
-    echo "No tzdata file found in ${SDKROOT}/usr/local/share/tz" 1>&2
+TARBALL="${SDKROOT}"/usr/local/share/tz/latest_tzdata.tar.gz
+if [ ! -L "$TARBALL" ]; then
+    echo "error: ${TARBALL} is not a symbolic link" 1>&2
     exit 1
 fi
-DATVERS=`basename ${TARBALL} | sed -e 's,\..*,,' -e 's/^tzdata//'`
+if [ ! -r "$TARBALL" ]; then
+    echo "error: ${TARBALL} does not point to a valid file" 1>&2
+    exit 1
+fi
+DATVERS=`readlink ${TARBALL} | cut -d. -f1 | sed -e 's/^tzdata//'`
 VERSIONFILE="${ZONEINFO}/+VERSION"
 
 mkdir -p "${DATFILES}"
 mkdir -p "${ZONEINFO}"
 tar zxf "${TARBALL}" -C "${DATFILES}"
+ZONE_FILES="$("${SRCROOT}"/zic.tproj/generate_zone_file_list.sh "${DATFILES}")"
 for tz in ${ZONE_FILES}; do
     if [ ${tz} = "northamerica" ]; then
         ARG="-p America/New_York"
     else
         ARG=""
     fi
-    ${ZICHOST} ${ARG} -L /dev/null -d "${ZONEINFO}" \
+    "${ZICHOST}" ${ARG} -L /dev/null -d "${ZONEINFO}" \
         -y "${DATFILES}/yearistype.sh" "${DATFILES}/${tz}" || exit 1
 done
+
 if [ $? -ne 0 ]; then
     exit 1
 fi
@@ -63,16 +67,29 @@ if [ $? -ne 0 ]; then
     exit 1
 fi
 
-if [ "${PLATFORM_NAME}" = "iphoneos" ]; then
+if [ -n "$RC_BRIDGE" ]; then
+    ACTUAL_PLATFORM_NAME="bridge${PLATFORM_NAME#watch}"
+else
+    ACTUAL_PLATFORM_NAME="${PLATFORM_NAME}"
+fi
+
+case "$ACTUAL_PLATFORM_NAME" in
+iphone*|appletv*|watch*)
     mkdir -p "${PRIVATEDIR}/var/db"
-    mkdir -p -m a+rwx "${PRIVATEDIR}/var/db/timezone"
+    mkdir -p -m a+rx "${PRIVATEDIR}/var/db/timezone"
 
     # This link must precisely start with TZDIR followed by a slash. radar:13532660
     ln -hfs "/var/db/timezone/zoneinfo/${LOCALTIME}" "${PRIVATEDIR}/var/db/timezone/localtime"
-else
+    ;;
+macosx|bridge*)
     mkdir -p "${PRIVATEDIR}/etc"
     ln -hfs "/usr/share/zoneinfo/${LOCALTIME}" "${PRIVATEDIR}/etc/localtime"
-fi
+    ;;
+*)
+    echo "Unsupported platform: $ACTUAL_PLATFORM_NAME"
+    exit 1
+    ;;
+esac
 
 rm -f "${VERSIONFILE}"
 echo ${DATVERS} > "${VERSIONFILE}"