Root/
| |
---|---|
Source at commit 2740 created 8 years 11 months ago. By ifabio, sync with trunk. | |
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 efiPartitionExist: either 0 or 1␊ |
13 | # Receives scriptDir: The location of the main script dir.␊ |
14 | ␊ |
15 | if [ "$#" -eq 4 ]; then␊ |
16 | ␉targetDisk="$1"␊ |
17 | ␉installerVolume="$2"␊ |
18 | ␉efiPartitionExist="$3"␊ |
19 | ␉scriptDir="$4"␊ |
20 | ␉echo "DEBUG: passed argument for targetDisk = $targetDisk"␊ |
21 | ␉echo "DEBUG: passed argument for installerVolume = $installerVolume"␊ |
22 | ␉echo "DEBUG: passed argument for efiPartitionExist = $efiPartitionExist"␊ |
23 | ␉echo "DEBUG: passed argument for scriptDir = $scriptDir"␊ |
24 | else␊ |
25 | ␉echo "Error - wrong number of values passed"␊ |
26 | ␉exit 9␊ |
27 | fi␊ |
28 | ␊ |
29 | # Check the first partition is actually type 'EFI'␊ |
30 | # as we could be checking a USB flash drive <4GB␊ |
31 | if [ ${efiPartitionExist} = 1 ]; then␊ |
32 | ␊ |
33 | ␉# Does the mountpoint exist?␊ |
34 | ␉if [ ! -e "/Volumes/EFI" ]; then␊ |
35 | ␉␉mkdir -p "/Volumes/EFI"␊ |
36 | ␉fi␊ |
37 | ␊ |
38 | ␉# Mount '/Volumes/EFI' using the correct format type␊ |
39 | ␉if [ "$( fstyp "${targetDisk}"s1 | grep hfs )" ]; then␊ |
40 | ␉␉"$scriptDir"InstallLog.sh "${installerVolume}" "Mounting ${targetDisk}s1 as /Volumes/EFI."␊ |
41 | ␉␉mount_hfs "${targetDisk}"s1 "/Volumes/EFI"␊ |
42 | ␉fi␊ |
43 | ␉if [ "$( fstyp "${targetDisk}"s1 | grep msdos )" ]; then␊ |
44 | ␉␉"$scriptDir"InstallLog.sh "${installerVolume}" "Mounting ${targetDisk}s1 as /Volumes/EFI."␊ |
45 | ␉␉mount_msdos -u 0 -g 0 "${targetDisk}"s1 "/Volumes/EFI"␊ |
46 | ␉fi␊ |
47 | else␊ |
48 | ␉"$scriptDir"InstallLog.sh "${installerVolume}" "Target volume doesn't have an EFI system partition."␊ |
49 | fi␊ |
50 | ␊ |
51 | exit 0 |