1#!/bin/sh 2 3TARGETDISK=${3} 4 5# Create keychains if not there already 6if [ ! -f "$TARGETDISK/System/Library/Keychains/X509Anchors" ]; then 7 "$TARGETDISK/usr/bin/security" create-keychain -p X509Anchors "$TARGETDISK/System/Library/Keychains/X509Anchors" 8fi 9 10if [ ! -f "$TARGETDISK/System/Library/Keychains/X509Certificates" ]; then 11 "$TARGETDISK/usr/bin/security" create-keychain -p X509Certificates "$TARGETDISK/System/Library/Keychains/X509Certificates" 12fi 13 14# Add all anchors 15if [ -d "$TARGETDISK/System/Library/Keychains/Anchors" ]; then 16 cd "$TARGETDISK/System/Library/Keychains/Anchors" 17 "$TARGETDISK/usr/bin/security" add-certificate -k "$TARGETDISK/System/Library/Keychains/X509Anchors" * 18 cd / 19 /bin/rm -rf "$TARGETDISK/System/Library/Keychains/Anchors" 20fi 21 22# Add all intermediates 23if [ -d "$TARGETDISK/System/Library/Keychains/Certificates" ]; then 24 cd "$TARGETDISK/System/Library/Keychains/Certificates" 25 "$TARGETDISK/usr/bin/security" add-certificate -k "$TARGETDISK/System/Library/Keychains/X509Certificates" * 26 cd / 27 /bin/rm -rf "$TARGETDISK/System/Library/Keychains/Certificates" 28fi 29