Chameleon

Chameleon Svn Source Tree

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

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

Archive Download this file

Revision: 1615