Chameleon

Chameleon Svn Source Tree

Root/branches/blackosx/package/Scripts/Sub/MountESP.sh

  • Property svn:executable set to *
1#!/bin/bash
2
3echo "==============================================="
4echo "MountESP: Mount the EFI system partition"
5echo "***********************************************"
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
15if [ "$#" -eq 4 ]; then
16targetDisk="$1"
17installerVolume="$2"
18efiPartitionExist="$3"
19scriptDir="$4"
20echo "DEBUG: passed argument for targetDisk = $targetDisk"
21echo "DEBUG: passed argument for installerVolume = $installerVolume"
22echo "DEBUG: passed argument for efiPartitionExist = $efiPartitionExist"
23echo "DEBUG: passed argument for scriptDir = $scriptDir"
24else
25echo "Error - wrong number of values passed"
26exit 9
27fi
28
29# Check the first partition is actually type 'EFI'
30# as we could be checking a USB flash drive <4GB
31if [ ${efiPartitionExist} = 1 ]; then
32
33# Does the mountpoint exist?
34if [ ! -e "/Volumes/EFI" ]; then
35mkdir -p "/Volumes/EFI"
36fi
37
38# Mount '/Volumes/EFI' using the correct format type
39if [ "$( fstyp "${targetDisk}"s1 | grep hfs )" ]; then
40"$scriptDir"InstallLog.sh "${installerVolume}" "Mounting ${targetDisk}s1 as /Volumes/EFI"
41mount_hfs "${targetDisk}"s1 "/Volumes/EFI"
42fi
43if [ "$( fstyp "${targetDisk}"s1 | grep msdos )" ]; then
44"$scriptDir"InstallLog.sh "${installerVolume}" "Mounting ${targetDisk}s1 as /Volumes/EFI"
45mount_msdos -u 0 -g 0 "${targetDisk}"s1 "/Volumes/EFI"
46fi
47else
48"$scriptDir"InstallLog.sh "${installerVolume}" "Target volume doesn't have an EFI system partition."
49fi
50
51exit 0

Archive Download this file

Revision: 1745