3 # Build SystemRootCerts.keychain and SystemTrustSettings.plist from
4 # all the certs in a given directory. Creates these two files in
5 # $LOCAL_BUILD_DIR and copies the results into /System/Library/Keychains/.
7 if ( $#argv != 1 ) then
8 echo "Usage: buildSysAnchors cert_dir"
9 echo "A typical run, when in the rootStoreTool dir, would be:"
10 echo "buildSysAnchors ../../../security_certificates/roots"
14 set BUILD_DIR
=$LOCAL_BUILD_DIR
15 set ROOT_KC
=SystemRootCerts.keychain
16 set ROOT_KC_PATH
=$BUILD_DIR/$ROOT_KC
17 set SETTINGS_FILE
=SystemTrustSettings.plist
18 set SETTINGS_FILE_PATH
=$BUILD_DIR/$SETTINGS_FILE
20 echo Creating empty
$ROOT_KC in build directory...
21 rm -f "$ROOT_KC_PATH" || exit(1)
22 security create
-keychain -p password
"$ROOT_KC_PATH" || exit(1)
24 echo Creating empty
$SETTINGS_FILE in build directory....
25 rm -f "$SETTINGS_FILE_PATH" || exit(1)
26 security add
-trusted-cert -o "$SETTINGS_FILE_PATH" || exit(1)
35 echo Processing
$root...
36 security import
"$root" -k "$ROOT_KC_PATH" -t cert
|| exit(1)
37 security add
-trusted-cert -i "$SETTINGS_FILE_PATH" -o "$SETTINGS_FILE_PATH" "$root" || exit(1)
40 set DST_PATH
=/System
/Library
/Keychains
42 echo Copying
$ROOT_KC and
$SETTINGS_FILE to
$DST_PATH...
43 cp $ROOT_KC_PATH $SETTINGS_FILE_PATH $DST_PATH || exit(1)