Chameleon

Chameleon Svn Source Tree

Root/trunk/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: To write install log to.
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"$scriptDir"InstallLog.sh "${targetVolumeChosenByUser}" "Volume named 'EFI' is mounted..."
27"$scriptDir"InstallLog.sh "${targetVolumeChosenByUser}" "Unmounting $( df | grep EFI | awk '{print $1}' )"
28umount -f $( df | grep EFI | awk '{print $1}' )
29(( attempts++ ))
30done
31if [ $attempts = 5 ]; then
32"$scriptDir"InstallLog.sh "${targetVolumeChosenByUser}" "Failed to unmount 'EFI' System Partition."
33exit 1
34fi
35
36exit 0
37
38
39
40

Archive Download this file

Revision: 1677