Chameleon

Chameleon Svn Source Tree

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

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

Archive Download this file

Revision: 1733