1 | #!/bin/bash␊ |
2 | ␊ |
3 | echo "==============================================="␊ |
4 | echo "Unmount all volumes named EFI"␊ |
5 | echo "*****************************"␊ |
6 | ␊ |
7 | # loop through and un-mount ALL mounted 'EFI' system partitions - Thanks kizwan␊ |
8 | ␊ |
9 | # Receives scriptDir: The location of the main script dir.␊ |
10 | # Receives targetVolumeTemp: Stores original target if EFI install selected.␊ |
11 | ␊ |
12 | if [ "$#" -eq 2 ]; then␊ |
13 | ␉targetVolumeTemp="$1"␊ |
14 | ␉scriptDir="$2"␊ |
15 | ␉echo "DEBUG: passed argument for targetVolumeTemp = $targetVolumeTemp"␊ |
16 | ␉echo "DEBUG: passed argument for scriptDir = $scriptDir"␊ |
17 | else␊ |
18 | ␉echo "Error - wrong number of values passed"␊ |
19 | ␉exit 9␊ |
20 | fi␊ |
21 | ␊ |
22 | ␊ |
23 | attempts=1␊ |
24 | while [ "$( df | grep EFI )" ] && [ "${attempts}" -lt 5 ]; do␊ |
25 | ␉echo "Unmounting $( df | grep EFI | awk '{print $1}' )"␊ |
26 | ␉umount -f $( df | grep EFI | awk '{print $1}' )␊ |
27 | ␉attempts=$(( ${attempts} + 1 ))␊ |
28 | done␊ |
29 | if [ ${attempts} = 5 ]; then␊ |
30 | ␉echo "failed to unmount 'EFI' System Partition."␊ |
31 | ␉echo "-----------------------------------------------"␊ |
32 | ␉"$scriptDir"InstallLog.sh "${targetVolumeTemp}" "Failed to unmount 'EFI' System Partition."␊ |
33 | ␉echo ""␊ |
34 | ␉echo ""␊ |
35 | ␉echo ""␊ |
36 | ␉exit 1␊ |
37 | fi␊ |
38 | ␊ |
39 | echo "-----------------------------------------------"␊ |
40 | echo ""␊ |
41 | echo ""␊ |
42 | echo ""␊ |
43 | ␊ |
44 | exit 0␊ |
45 | ␊ |
46 | ␊ |
47 | ␊ |
48 | |