AFP548 Changing the world one server at a time.

Lauching Keychain Minder with a LaunchAgent

Home › Forums › OS X Server and Client Discussion › Active Directory › Lauching Keychain Minder with a LaunchAgent

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #377530
    rtrouton
    Participant

    I’m looking to deploy Keychain Minder and have it launched on the user’s login with a LaunchAgent stored in /Library/LaunchAgents. Has anyone seen any gotchas with using Keychain Minder this way?

    #377533
    walt
    Participant

    I do this and it works great for me. Here is the postflight script I use to install it with a package. Just make an installer package and install Keychain Minder in /Applications/Utilities. Change com.yourcompany in the script to whatever your orgs name is if you want.

    #!/bin/sh
    
    # Install Keychain Minder and a Launchd item so it starts for every user.
    
    # Declare 'defaults'and 'PlistBuddy'.
    
    defaults="/usr/bin/defaults"
    PlistBuddy="/usr/libexec/PlistBuddy"
    
    # Declare our working directories.
    
    PKG_DIR="$1/Contents/Resources"
    APP_DIR="$3/Applications/Utilities"
    LAUNCHD_DIR="$3/Library/LaunchAgents"
    
    # Install Launchd item to /Library/LaunchAgents.
    
    $defaults write "${LAUNCHD_DIR}/com.yourcompany.keychainminder" Label com.yourcompany.keychainminder
    $defaults write "${LAUNCHD_DIR}/com.yourcompany.keychainminder" ProgramArguments -array
    $PlistBuddy -c "Add :ProgramArguments:Item\ 1 string /Applications/Utilities/Keychain\ Minder.app/Contents/MacOS/Keychain\ Minder" "${LAUNCHD_DIR}/com.yourcompany.keychainminder.plist"
    $defaults write "${LAUNCHD_DIR}/com.yourcompany.keychainminder" RunAtLoad -bool YES
    
    # Give Launchd item correct permissions.
    
    chown root:wheel "${LAUNCHD_DIR}/com.yourcompany.keychainminder.plist"
    chmod 644 "${LAUNCHD_DIR}/com.yourcompany.keychainminder.plist"
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.