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
26echo "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
33echo "failed to unmount 'EFI' System Partition."
34echo "-----------------------------------------------"
35"$scriptDir"InstallLog.sh "${targetVolumeChosenByUser}" "Failed to unmount 'EFI' System Partition."
36echo ""
37echo ""
38echo ""
39exit 1
40fi
41
42echo "-----------------------------------------------"
43echo ""
44echo ""
45echo ""
46
47exit 0
48
49
50
51

Archive Download this file

Revision: 1614