Guest User

Untitled

a guest
Jan 17th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # The goal of this script is to install a profile for each login user on a Mac
  4. # device, taking into consideration the discrepancies between the profiles tool
  5. # on High Sierra versus older versions.
  6.  
  7.  
  8. # The should combine to create the absolute path of the profile
  9. profileName='/test cert.mobileconfig'
  10. profilePath='/Library/Addigy/ansible/packages/Certificate Test'
  11.  
  12. # Set permissions for the certificate
  13. chown -R root:staff "${profilePath}"
  14. chmod -R 775 "${profilePath}"
  15.  
  16. # Grab macOS version
  17. macOSVersion=$(sw_vers -productVersion | awk -F. '{print $2}')
  18. echo "Detected: macOS version 10.${macOSVersion}"
  19.  
  20. if [ "${macOSVersion}" = "" ]; then
  21. echo "Error: Couldn't pull macOS version."
  22. exit 1
  23. elif (( macOSVersion >= 13 )); then
  24. echo "Running 10.${macOSVersion} install."
  25. for user in $(dscl . list /Users UniqueID | awk '$2 >= 500 {print $1}'); do
  26. /usr/bin/profiles install -user $user -path "${profilePath}${profileName}" -forced
  27. done
  28. else
  29. echo "Running 10.${macOSVersion} install."
  30. for user in $(dscl . list /Users UniqueID | awk '$2 >= 500 {print $1}'); do
  31. /usr/bin/profiles -IF "${profilePath}${profileName}" -U $user
  32. done
  33. fi
Add Comment
Please, Sign In to add comment