#!/bin/sh
PATH=/bin:/sbin:/usr/bin:/usr/sbin; export PATH
# addLoginItem.sh
# $1: full path to the installation package
# $2: full path to the installation destination
# $3: mountpoint of the destination volume
# $4: root directory / for the current System folder
plistBuddy="$1"/Contents/Resources/PlistBuddy
# We will check to see if Keychain Minder is already a login item (in the loginwindow.plist). If it is not, we will add it using PlistBuddy.
# The plist we are writing to:
userPlist="$3"/Users/$USER/Library/Preferences/loginwindow.plist
# Look for Keychain Minder in loginwindow.plist:
keychainExists=`defaults read "$3"/Users/$USER/Library/Preferences/loginwindow | grep "Keychain Minder"`
if [ "$keychainExists" = "" ]; then
$plistBuddy -c 'Add :AutoLaunchedApplicationDictionary:0 dict' "$userPlist"
$plistBuddy -c 'Add :AutoLaunchedApplicationDictionary:0:Hide bool false' "$userPlist"
$plistBuddy -c 'Add :AutoLaunchedApplicationDictionary:0:Path string "/Applications/Utilities/Keychain Minder.app"' "$userPlist"
fi
exit 0