Chameleon

Chameleon Svn Source Tree

Root/branches/ErmaC/Trunk/package/Scripts/Sub/UnMountEFIvolumes.sh

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

Archive Download this file

Revision: 1871