Created
February 26, 2015 20:03
-
-
Save jacobsalmela/65aa7a7102a29b82daba to your computer and use it in GitHub Desktop.
Reset the volume name to "Macintosh HD" if it is different.
This file contains hidden or 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
#!/bin/bash | |
volumeName=$(diskutil info / | awk '/Volume Name/ {print substr ($0, index ($0,$3))}') | |
echo "Current volume name: $volumeName" | |
# If the volume is not named Macintosh HD | |
if [ "$volumeName" != "Macintosh HD" ];then | |
# Rename it | |
diskutil renameVolume "$volumeName" "Macintosh HD" | |
volumeName=$(diskutil info / | awk '/Volume Name/ {print substr ($0, index ($0,$3))}') | |
echo "Root volume is now named: $volumeName" | |
exit 0 | |
else | |
# Exit 1 because something went wrong | |
echo "Something went wrong." | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment