-
Notifications
You must be signed in to change notification settings - Fork 1
/
MountEFI
61 lines (51 loc) · 1.32 KB
/
MountEFI
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
clear
echo Mount EFI Partition:
echo
ls /volumes/
echo
echo
read drive
if [ "$drive" == "" ]; then
drive="/"
fi
if [ ! -d "$drive" ]; then
if [ -d "/volumes/$drive" ]; then
#It was just volume name
drive="/Volumes/$drive"
else
echo The drive is not a directory or does not exist.
exit
fi
fi
#Get disk info for later use...
diskName="$( diskutil info "$drive" | grep 'Volume Name' | cut -d : -f 2 | sed 's/^ *//g' | sed 's/ *$//g' )"
diskNums="$( diskutil info "$drive" | grep 'Device Identifier' | cut -d k -f 2 )"
disk="$( echo "$diskNums" | cut -d s -f 1 )"
part="$( echo "$diskNums" | cut -d s -f 2 )"
clear
endOfDisk="0"
i=1
echo Searching for EFI partitions on "$diskName":
echo
while [ "$endOfDisk" == "0" ]; do
currentDisk=disk"$disk"s"$i"
currentDiskCheck="$( diskutil info $currentDisk )"
tempCheck=${currentDiskCheck:0:19}
if [ "$tempCheck" == "Could not find disk" ]; then
echo End of partitions.
echo
endOfDisk="true"
continue
fi
echo Checking "$currentDisk"...
currentDiskType="$( diskutil info $currentDisk | grep 'Partition Type' | cut -d : -f 2 | sed -e 's/^[[:space:]]*//' )"
echo Current Disk Type: "$currentDiskType"
if [ "$currentDiskType" == "EFI" ]; then
echo Partition Type is EFI.
echo Mounting...
diskutil mount $currentDisk
fi
i="$( expr $i + 1 )"
echo
done