Posted on 11-03-2015 03:05 PM
Any chance someone has already done the work to write an EA that can detect if a system has a recovery partition?
Solved! Go to Solution.
Posted on 11-03-2015 03:54 PM
There's "Recovery HD Present" in the EA templates in the JSS.
Provides a simple "Present/Not Present" result.
#!/bin/sh
recoveryHDPresent=`/usr/sbin/diskutil list | grep "Recovery HD" | grep disk0`
if [ "$recoveryHDPresent" != "" ]; then
echo "<result>Present</result>"
else
echo "<result>Not Present</result>"
fi
Posted on 11-03-2015 03:54 PM
There's "Recovery HD Present" in the EA templates in the JSS.
Provides a simple "Present/Not Present" result.
#!/bin/sh
recoveryHDPresent=`/usr/sbin/diskutil list | grep "Recovery HD" | grep disk0`
if [ "$recoveryHDPresent" != "" ]; then
echo "<result>Present</result>"
else
echo "<result>Not Present</result>"
fi
Posted on 11-03-2015 04:36 PM
If you want it to be very simple (and potentially easy to trick if one was inclined).
#!/bin/bash
if [ "$(diskutil list | awk '/Recovery HD/')" ]; then
echo "<result>TRUE</result>"
else
echo "<result>FALSE</result>"
fi
Posted on 11-04-2015 06:26 AM
Thanks!
@hkabik, I must have fat fingered my search when I was looking through those. I've been doing that a lot lately. lol
Posted on 03-08-2018 09:41 AM
For anyone running 10.13.x the Recovery partition is no longer "Recovery HD" and it's not at disk0. Might be good to put an OS check to run a modified version if it's on 10.13, or just loosen up the search by using "Recovery"* and drop the disk0 grep.