1 | #!/bin/bash␊ |
2 | ␊ |
3 | echo "==============================================="␊ |
4 | echo "MountESP: Mount the EFI system partition"␊ |
5 | echo "***********************************************"␊ |
6 | ␊ |
7 | # Creates a mountpoint and mounts /Volumes/EFI of the␊ |
8 | # supplied disk which would have been pre-checked as using a GPT␊ |
9 | ␊ |
10 | # Receives targetDisk: for example /dev/disk2.␊ |
11 | # Receives installerVolume: Volume to write the installer log to.␊ |
12 | # Receives scriptDir: The location of the main script dir.␊ |
13 | ␊ |
14 | if [ "$#" -eq 3 ]; then␊ |
15 | ␉targetDisk="$1"␊ |
16 | ␉installerVolume="$2"␊ |
17 | ␉scriptDir="$3"␊ |
18 | ␉echo "DEBUG: passed argument for targetDisk = $targetDisk"␊ |
19 | ␉echo "DEBUG: passed argument for installerVolume = $installerVolume"␊ |
20 | ␉echo "DEBUG: passed argument for scriptDir = $scriptDir"␊ |
21 | else␊ |
22 | ␉echo "Error - wrong number of values passed"␊ |
23 | ␉exit 9␊ |
24 | fi␊ |
25 | ␊ |
26 | ␊ |
27 | # Does the mountpoint exist?␊ |
28 | if [ ! -e "/Volumes/EFI" ]; then␊ |
29 | ␉mkdir -p "/Volumes/EFI"␊ |
30 | fi␊ |
31 | ␊ |
32 | # Mount '/Volumes/EFI' using the correct format type␊ |
33 | if [ "$( fstyp "${targetDisk}"s1 | grep hfs )" ]; then␊ |
34 | ␉"$scriptDir"InstallLog.sh "${installerVolume}" "Mounting ${targetDisk}s1 as /Volumes/EFI"␊ |
35 | ␉mount_hfs "${targetDisk}"s1 "/Volumes/EFI"␊ |
36 | fi␊ |
37 | if [ "$( fstyp "${targetDisk}"s1 | grep msdos )" ]; then␊ |
38 | ␉"$scriptDir"InstallLog.sh "${installerVolume}" "Mounting ${targetDisk}s1 as /Volumes/EFI"␊ |
39 | ␉mount_msdos -u 0 -g 0 "${targetDisk}"s1 "/Volumes/EFI"␊ |
40 | fi␊ |
41 | ␊ |
42 | exit 0 |