]>
code.delx.au - refind/blob - mountesp
3 # Mount the ESP at /Volumes/ESP or determine its current mount
6 # Identify the ESP. Note: This returns the FIRST ESP found;
7 # if the system has multiple disks, this could be wrong!
8 Temp
=$
(mount |
sed -n -E "/^(\/dev\/disk[0-9]+s[0-9]+) on \/ \(.*$/s//\1/p")
10 Temp
=$
(diskutil list |
grep " EFI " |
grep -o 'disk.*' |
head -n 1)
12 echo "Warning: root device doesn't have an EFI partition"
15 echo "Warning: root device could not be found"
18 Temp
=$
(diskutil list |
sed -n -E '/^ *[0-9]+:[ ]+EFI EFI[ ]+[0-9.]+ [A-Z]+[ ]+(disk[0-9]+s[0-9]+)$/ { s//\1/p
23 echo "Could not find an EFI partition. Aborting!"
28 # If the ESP is mounted, use its current mount point....
29 Temp
=`df -P | grep "$Esp "`
30 MountPoint
=`echo $Temp | cut -f 6- -d ' '`
31 if [[ "$MountPoint" == '' ]] ; then
32 MountPoint
="/Volumes/ESP"
33 mkdir
/Volumes
/ESP
&> /dev
/null
34 mount
-t msdos
"$Esp" /Volumes
/ESP
35 # Some systems have HFS+ "ESPs." They shouldn't, but they do. If this is
36 # detected, mount it as such and set appropriate options.
37 if [[ $?
!= 0 ]] ; then
38 mount
-t hfs
"$Esp" /Volumes
/Esp
39 if [[ $?
!= 0 ]] ; then
40 echo "Unable to mount ESP!\n"
45 echo "The ESP is mounted at $MountPoint"
49 # Main part of script....
57 echo "This script is meant to be run under OS X *ONLY*! Exiting!"