Skip to content

Instantly share code, notes, and snippets.

@triti
Created May 30, 2014 20:16
Show Gist options
  • Save triti/6fbb9900a406579eb394 to your computer and use it in GitHub Desktop.
Save triti/6fbb9900a406579eb394 to your computer and use it in GitHub Desktop.
Absolute Manage custom information field to display whether Gatekeeper is enabled or not
#!/bin/bash
# https://gist.github.com/6fbb9900a406579eb394
# Absolute Manage custom information field to display the current Gatekeeper
# status. Based on the script by Rich Trouton
# https://github.com/rtrouton/rtrouton_scripts/blob/master/rtrouton_scripts/check_gatekeeper_status/check_gatekeeper_status.sh
result=''
os_version="$(/usr/bin/sw_vers -productVersion | awk -F. '{print $2}')"
if [[ "${os_version}" -ge 7 ]]; then
gatekeeper_status="$(/usr/sbin/spctl --status | /usr/bin/awk '/assessments/ { print $2; }')"
if [[ "${gatekeeper_status}" = 'disabled' ]]; then
result='No'
else
result='Yes'
fi
fi
echo "${result}"
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment