]> git.saurik.com Git - apple/system_cmds.git/blob - zic.tproj/install_zoneinfo.sh
system_cmds-790.20.2.tar.gz
[apple/system_cmds.git] / zic.tproj / install_zoneinfo.sh
1 #!/bin/sh
2 set -e
3 set -x
4
5 if [ -n "$RC_BRIDGE" ]; then
6 ACTUAL_PLATFORM_NAME="bridgeos"
7 else
8 ACTUAL_PLATFORM_NAME="${PLATFORM_NAME}"
9 fi
10
11 # This sets up the paths for the default set of zoneinfo files
12 # On iOS, watchOS, and tvOS, this is handled by tzd in coordination with
13 # launchd on first boot.
14 # On macOS, the directory needs to be setup # during mastering for SIP
15 # protection, and the symlink for the BaseSystem.
16 # On bridgeOS tzd doesn't exist, so needs this all setup statically.
17 default_zoneinfo_setup()
18 {
19 mkdir -p "${DSTROOT}/private/var/db/timezone"
20 chmod 555 "${DSTROOT}/private/var/db/timezone"
21 ln -hfs "/usr/share/zoneinfo.default" "${DSTROOT}/private/var/db/timezone/zoneinfo"
22 }
23
24 case "$ACTUAL_PLATFORM_NAME" in
25 iphone*|appletv*|watch*|macosx)
26 ditto "${BUILT_PRODUCTS_DIR}/zoneinfo" "${DSTROOT}/usr/share/zoneinfo.default"
27 ln -hfs "/var/db/timezone/zoneinfo" "${DSTROOT}/usr/share/zoneinfo"
28 case "$ACTUAL_PLATFORM_NAME" in
29 macosx)
30 default_zoneinfo_setup
31 ;;
32 esac
33 ;;
34 bridge*)
35 # Since bridgeOS lacks any mechanism to change timezones (currently),
36 # and in the interest of saving space, only GMT is installed.
37 mkdir -p "${DSTROOT}/usr/share/zoneinfo.default"
38 chmod 555 "${DSTROOT}/usr/share/zoneinfo.default"
39 ditto "${BUILT_PRODUCTS_DIR}/zoneinfo/GMT" "${DSTROOT}/usr/share/zoneinfo.default/GMT"
40 default_zoneinfo_setup
41 ;;
42 *)
43 echo "Unsupported platform: $ACTUAL_PLATFORM_NAME"
44 exit 1
45 ;;
46 esac
47