Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add install check script to Escrow Buddy #652

Merged
merged 1 commit into from
Jul 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions Escrow Buddy/Escrow Buddy.munki.recipe
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,49 @@ echo "Escrow Buddy successfully uninstalled."
<string>com.github.homebysix.download.EscrowBuddy</string>
<key>Process</key>
<array>
<dict>
<key>Arguments</key>
<dict>
<key>additional_pkginfo</key>
<dict>
<key>installcheck_script</key>
<string>#!/bin/zsh

# Exit codes
PROCEED_WITH_INSTALL=0
INSTALL_NOT_NEEDED=1

# Check whether mechanism is present in the authorization database
DBENTRY="&lt;string&gt;Escrow Buddy:Invoke,privileged&lt;/string&gt;"
if ! /usr/bin/security authorizationdb read system.login.console 2&gt;/dev/null | grep -q "$DBENTRY"; then
exit $PROCEED_WITH_INSTALL
fi

# Check whether receipt is present
if [[ ! -f "/var/db/receipts/com.netflix.Escrow-Buddy.plist" ]]; then
exit $PROCEED_WITH_INSTALL
fi

# Check whether bundle is present
if [[ ! -d "/Library/Security/SecurityAgentPlugins/Escrow Buddy.bundle" ]]; then
exit $PROCEED_WITH_INSTALL
fi

# Check whether bundle is up to date
autoload is-at-least
INSTALLED_VERSION=$(defaults read "/Library/Security/SecurityAgentPlugins/Escrow Buddy.bundle/Contents/Info.plist" CFBundleShortVersionString)
OFFERED_VERSION="%version%"
if ! is-at-least "$OFFERED_VERSION" "$INSTALLED_VERSION"; then
exit $PROCEED_WITH_INSTALL
fi

exit $INSTALL_NOT_NEEDED
</string>
</dict>
</dict>
<key>Processor</key>
<string>MunkiPkginfoMerger</string>
</dict>
<dict>
<key>Arguments</key>
<dict>
Expand Down
Loading