Chameleon

Chameleon Svn Source Tree

Root/branches/blackosx/package/Scripts.templates/UnMount/UnMountEFIvolumes.sh

  • Property svn:executable set to *
1#!/bin/bash
2
3# loop through and un-mount ALL mounted 'EFI' system partitions - Thanks kizwan
4
5# Receives targetVolumeChosenByUser: To write install log to.
6# Receives scriptDir: The location of the main script dir.
7
8if [ "$#" -eq 2 ]; then
9targetVolumeChosenByUser="$1"
10scriptDir="$2"
11# echo "DEBUG: passed argument for targetVolumeChosenByUser = $targetVolumeChosenByUser"
12# echo "DEBUG: passed argument for scriptDir = $scriptDir"
13else
14echo "Error - wrong number of values passed" >&2
15exit 9
16fi
17
18logName="@LOG_FILENAME@"
19logFile="${targetVolumeChosenByUser}/$logName"
20
21exec >>"${logFile}" 2>&1
22
23echo "Check for and unmount all volumes named EFI..."
24
25# Count of 5 exists incase for some reason /Volumes/EFI fails
26# to be unmounted in which case the loop would run forever.
27attempts=1
28while [ "$( df | grep EFI )" ] && [ $attempts -lt 5 ]; do
29#"$scriptDir"InstallLog.sh "${targetVolumeChosenByUser}" "Volume named 'EFI' is mounted..."
30#"$scriptDir"InstallLog.sh "${targetVolumeChosenByUser}" "Unmounting $( df | grep EFI | awk '{print $1}' )"
31echo "Volume named 'EFI' is mounted."
32echo "Unmounting $( df | grep EFI | awk '{print $1}' )"
33umount -f $( df | grep EFI | awk '{print $1}' )
34(( attempts++ ))
35done
36if [ $attempts = 5 ]; then
37"$scriptDir"InstallLog.sh "${targetVolumeChosenByUser}" "Failed to unmount 'EFI' System Partition."
38exit 1
39fi
40
41exit 0
42

Archive Download this file

Revision: 1811