Created
January 9, 2012 01:22
-
-
Save acidprime/1580423 to your computer and use it in GitHub Desktop.
Example Keychain Deletion Script for User Template
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
declare -x USER_NAME="$1" | |
declare -x TEMPLATE_KEYCHAIN="/System/Library/User Template/English.lproj/Library/Keychains/login.keychain" | |
declare -x USER_KEYCHAIN="/Users/$USER_NAME/Library/Keychains/login.keychain" | |
# Commands | |
declare -x rm="/bin/rm" | |
declare -x mv="/bin/mv" | |
declare -x logger="/usr/bin/logger" | |
if [ -f "$TEMPLATE_KEYCHAIN" ] ; then | |
$rm "$TEMPLATE_KEYCHAIN" | |
if [ -f "$USER_KEYCHAIN" ] ;then | |
# We only remove the users keychain if we have never run before | |
$rm "$USER_KEYCHAIN" | |
fi | |
exit 0 | |
else | |
$logger "Keychain not found in User Template" | |
exit 0 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment