Chameleon

Chameleon Svn Source Tree

Root/branches/blackosx/package/Scripts/Install/CheckProceed.sh

  • Property svn:executable set to *
1#!/bin/bash
2
3echo "==============================================="
4echo "Check Proceed: Can the script continue?"
5echo "***************************************"
6
7# Checks the selected volume is present and the disk is partitioned.
8
9# Receives targetVolume: Volume to install to (Will be '/Volumes/EFI' if EFI install)
10# Receives targetDevice: Stores device number, for example /dev/disk2s1.
11# Receives installerVolume: Volume to write the installer log to.
12# Receives scriptDir: The location of the main script dir.
13
14if [ "$#" -eq 4 ]; then
15targetVolume="$1"
16targetDevice="$2"
17installerVolume="$3"
18scriptDir="$4"
19echo "DEBUG: passed argument for targetVolume = $targetVolume"
20echo "DEBUG: passed argument for targetDevice = $targetDevice"
21echo "DEBUG: passed argument for installerVolume = $installerVolume"
22echo "DEBUG: passed argument for scriptDir = $scriptDir"
23else
24echo "Error - wrong number of values passed"
25exit 9
26fi
27
28if [ -z "$targetVolume" ]; then
29echo "*** Cannot find the volume. Exiting."
30"$scriptDir"InstallLog.sh "${installerVolume}" "FAIL: Cannot file the volume: $targetVolume."
31exit 1
32else
33echo "Confirming target volume exists"
34fi
35
36if [ "$targetDevice" = "$targetDevice#*disk*s" ]; then
37echo "*** ERROR Volume does not use slices. Exiting."
38"$scriptDir"InstallLog.sh "${installerVolume}" "FAIL: $targetVolume doesn't use slices."
39exit 1
40else
41echo "Confirming target device uses slices"
42fi
43
44# Add check for installing to a 'small' HFS device like a
45# 1GB USB flash drive which won't have an EFI System Partition.
46
47if [ "$targetVolume" = "/Volumes/EFI" ]; then
48# Take target device and check slice 1 matches partition named "EFI"
49stripped=$( echo ${targetDevice#/dev/} )
50if [ ! $(echo ${stripped#*disk*s}) = 1 ]; then
51stripped=$( echo ${stripped%s*})"s1"
52fi
53if [ ! $( diskutil list | grep ${stripped} | awk {'print $2'} ) = "EFI" ]; then
54echo "*** The selected volume doesn't have an EFI System Partition. Exiting."
55"$scriptDir"InstallLog.sh "${installerVolume}" "FAIL: Selected disk does not have an EFI System Partition."
56exit 1
57fi
58fi
59
60echo "-----------------------------------------------"
61echo ""
62
63#"$scriptDir"InstallLog.sh "${installerVolume}" "CheckProceed: PASS"
64
65exit 0

Archive Download this file

Revision: 1558