Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Install PrivilegedHelper and LaunchDaemon for the McAfee ENS 10.7.1 version of McAfee Agent Status Monitor.app so users aren't prompted for admin credentials to do the install the first time they slect the app from the McAfee Menulet
#!/bin/sh
# Install PrivilegedHelper and LaunchDaemon for the McAfee ENS 10.7.1 version of
# McAfee Agent Status Monitor.app so users aren't prompted for admin credentials to
# do the install the first time they select the app from the McAfee Menulet
helperSourcePath="/Library/Application Support/McAfee/MSS/Applications/McAfee Agent Status Monitor.app/Contents/Library/LaunchServices/com.mcafee.agentMonitor.helper"
helperDestinationPath="/Library/PrivilegedHelperTools/com.mcafee.agentMonitor.helper"
if [ -f "$helperSourcePath" ] && [ ! -f "helperDestinationPath" ]; then
if [ ! -d "/Library/PrivilegedHelperTools" ]; then
/bin/mkdir -p "/Library/PrivilegedHelperTools"
/bin/chmod 755 "/Library/PrivilegedHelperTools"
/usr/sbin/chown -R root:wheel "/Library/PrivilegedHelperTools"
fi
if /bin/cp -f "$helperSourcePath" "/Library/PrivilegedHelperTools"; then
/bin/chmod 755 "$helperDestinationPath"
# create the LaunchDaemon plist
helperPlistPath="/Library/LaunchDaemons/com.mcafee.agentMonitor.helper.plist"
/bin/cat > "$helperPlistPath" << EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.mcafee.agentMonitor.helper</string>
<key>MachServices</key>
<dict>
<key>com.mcafee.agentMonitor.helper</key>
<true/>
</dict>
<key>Program</key>
<string>/Library/PrivilegedHelperTools/com.mcafee.agentMonitor.helper</string>
<key>ProgramArguments</key>
<array>
<string>/Library/PrivilegedHelperTools/com.mcafee.agentMonitor.helper</string>
</array>
</dict>
</plist>
EOF
/bin/chmod 644 "$helperPlistPath"
/bin/launchctl bootstrap system "$helperPlistPath"
fi
fi
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment