Skip to main content
Solved

Computer Extension Attributes - Missing output


Forum|alt.badge.img+5

Feel like I have to be missing something obvious here... but I can't seem to get this to behave. Trying to make an extension attribute that checks if homebrew is installed, and outputs the result of "which brew" if so.... pretty basic. This works perfectly from terminal both as my standard user and as root... but when jamf runs it... all that's returned to the extension attribute is "Installed: " with no file path listed.

From terminal, i get what seems to be a proper output jamf should be happy with:

sh-3.2# ./test2.sh <result>Installed: /opt/homebrew/bin/brew</result>

Extension Attribute Code:

#!/bin/bash if [[ $(which brew) != "brew not found" ]]; then brewstatus="Installed: $(which brew)" else brewstatus="Not installed" fi echo "<result>$brewstatus</result>" exit 0

 

Best answer by abremel

annnd eventually found an answer here - guessing its something to do with my path and profile, if i run this as the current user things seem to behave... https://community.jamf.com/t5/jamf-pro/homebrew-detection/td-p/275201

View original
Did this topic help you find an answer to your question?

3 replies

Forum|alt.badge.img+5
  • Author
  • New Contributor
  • 5 replies
  • January 9, 2024

Ok, so realized my if logic was wrong if brew *isn't* installed - as which is blank in that case as root, but that still doesn't solve the original problem of the path not being brought into the extension attribute... updating my code snippet regardless:

#!/bin/bash if [ -z $(which brew) !]; then brewstatus="Not Installed" else brewstatus="Installed: $(which brew)" fi echo "<result>$brewstatus</result>" exit 0

 


Forum|alt.badge.img+5
  • Author
  • New Contributor
  • 5 replies
  • January 9, 2024
abremel wrote:

Ok, so realized my if logic was wrong if brew *isn't* installed - as which is blank in that case as root, but that still doesn't solve the original problem of the path not being brought into the extension attribute... updating my code snippet regardless:

#!/bin/bash if [ -z $(which brew) !]; then brewstatus="Not Installed" else brewstatus="Installed: $(which brew)" fi echo "<result>$brewstatus</result>" exit 0

 


Condensed down to a super basic test - this comes back blank: seems like it's just not bringing in the output of that command... or perhaps which brew is returning blank when jamf runs it? I get output when i run it as root...

echo "<result>$(which brew)</result>" exit 0

Forum|alt.badge.img+5
  • Author
  • New Contributor
  • 5 replies
  • Answer
  • January 9, 2024

annnd eventually found an answer here - guessing its something to do with my path and profile, if i run this as the current user things seem to behave... https://community.jamf.com/t5/jamf-pro/homebrew-detection/td-p/275201


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings