Lion Recovery Partition Ext. Attribute - Misreporting?

mcrispin
Contributor II

Running this extension attribute I am finding that it reports as "Not Present" on systems with multiple drives, and possibly OSX Lion server. Is anyone seeing the same thing?

1 ACCEPTED SOLUTION

jhbush
Valued Contributor II

I've seen this as well. I edited my extension attribute like so:

#!/bin/sh

recoveryHDPresent=/usr/sbin/diskutil list | grep "Recovery HD"

if [ "$recoveryHDPresent" != "" ]; then echo "<result>Present</result>"
else echo "<result>Not Present</result>"
fi

View solution in original post

4 REPLIES 4

jhbush
Valued Contributor II

I've seen this as well. I edited my extension attribute like so:

#!/bin/sh

recoveryHDPresent=/usr/sbin/diskutil list | grep "Recovery HD"

if [ "$recoveryHDPresent" != "" ]; then echo "<result>Present</result>"
else echo "<result>Not Present</result>"
fi

mcrispin
Contributor II

Yup - I probably should have noticed that disk0 business too! :)

This works, thanks for your help!

danny_hanes
Contributor

For anyone who comes across this later, I found that the following worked on 10.11.4

#!/bin/sh

recoveryHDPresent='/usr/sbin/diskutil list | grep "Recovery HD"'

if [ "$recoveryHDPresent" != "" ]; then echo "<result>Present</result>"

else echo "<result>Not Present</result>"

fi

mm2270
Legendary Contributor III

@dhanes You might want to edit your script to change the single quotes into backticks, or preferable command parenthesis. I.e, either

recoveryHDPresent=`/usr/sbin/diskutil list | grep "Recovery HD"`

or

recoveryHDPresent=$(/usr/sbin/diskutil list | grep "Recovery HD")

The way its posted right now, its not actually running a command. Its just a single quoted string.