Created
May 30, 2024 00:59
-
-
Save cwmoriarty/afdd1e252ad724f8c9b656b3b83e2e2d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -e | |
logpath="/tmp/apfs_log.txt" | |
{ | |
diskutil apfs list | |
printf "\n" | |
diskutil apfs snapshots / | |
printf "\n" | |
rootdev=$(diskutil info -plist / | plutil -extract DeviceIdentifier raw - | rev | cut -c3- | rev) | |
echo "Root device: $rootdev" | |
mntpnt="/tmp/rootdev.noindex" | |
if [ -d "$mntpnt" ]; then | |
echo "Removing existing mount point: $mntpnt" | |
sudo umount -f "$mntpnt" || true | |
rm -rf "$mntpnt" | |
fi | |
echo "Mounting to $mntpnt (prepare for sudo prompt)" | |
mkdir -p "$mntpnt" | |
sudo mount -t apfs -o ro,nobrowse "$rootdev" "$mntpnt" | |
echo "Mounted to $mntpnt" | |
printf "\n" | |
echo "Booted snapshot:" | |
plutil -p "/System/Library/CoreServices/SystemVersion.plist" | |
what /sbin/launchd | |
shasum /sbin/launchd | |
printf "\n" | |
echo "Raw volume:" | |
plutil -p "$mntpnt/System/Library/CoreServices/SystemVersion.plist" | |
what "$mntpnt/sbin/launchd" | |
shasum "$mntpnt/sbin/launchd" | |
printf "\n" | |
echo "Unmounting $mntpnt" | |
sudo umount "$mntpnt" | |
echo "Unmounted $mntpnt" | |
rm -rf "$mntpnt" | |
printf "\n" | |
echo "Booted cryptex:" | |
plutil -p /System/Cryptexes/OS/System/Library/CoreServices/SystemVersion.plist | |
if [ -d "/System/Volumes/Preboot/Cryptexes/Incoming/OS/System" ]; then | |
printf "\n" | |
echo "Incoming cryptex:" | |
plutil -p /System/Volumes/Preboot/Cryptexes/Incoming/OS/System/Library/CoreServices/SystemVersion.plist | |
fi | |
printf "\n" | |
volumegroup=$(diskutil info -plist / | plutil -extract APFSVolumeGroupID raw -) | |
echo "Volume group: $volumegroup" | |
if [ -f "/System/Volumes/Preboot/$volumegroup/System/Library/CoreServices/SystemVersion.plist" ]; then | |
printf "\n" | |
echo "Preboot version:" | |
plutil -p "/System/Volumes/Preboot/$volumegroup/System/Library/CoreServices/SystemVersion.plist" | |
fi | |
printf "\n" | |
echo "Booted cryptex (offline):" | |
plutil -p "/System/Volumes/Preboot/$volumegroup/cryptex1/current/SystemVersion.plist" | |
plutil -extract ProductVersion raw "/System/Volumes/Preboot/$volumegroup/cryptex1/current/BuildManifest.plist" | |
plutil -extract ProductBuildVersion raw "/System/Volumes/Preboot/$volumegroup/cryptex1/current/BuildManifest.plist" | |
if [ -f "/System/Volumes/Preboot/$volumegroup/cryptex1/proposed/SystemVersion.plist" ]; then | |
printf "\n" | |
echo "Incoming cryptex (offline):" | |
plutil -p "/System/Volumes/Preboot/$volumegroup/cryptex1/proposed/SystemVersion.plist" | |
plutil -extract ProductVersion raw "/System/Volumes/Preboot/$volumegroup/cryptex1/proposed/BuildManifest.plist" | |
plutil -extract ProductBuildVersion raw "/System/Volumes/Preboot/$volumegroup/cryptex1/proposed/BuildManifest.plist" | |
fi | |
printf "\n" | |
echo "Restore manifest:" | |
plutil -extract ProductVersion raw "/System/Volumes/Preboot/$volumegroup/restore/BuildManifest.plist" | |
plutil -extract ProductBuildVersion raw "/System/Volumes/Preboot/$volumegroup/restore/BuildManifest.plist" | |
} 2>&1 | tee "$logpath" | |
echo "Log saved to $logpath" | |
open -R "$logpath" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment