Chameleon

Chameleon Svn Source Tree

Root/branches/ErmaC/Trunk/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 target disk 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# Does target volume exist?
33if [ -z "$targetVolume" ]; then
34echo "*** Cannot find the volume. Exiting."
35"$scriptDir"InstallLog.sh "${installerVolume}" "FAIL: Cannot file the volume: $targetVolume."
36exit 2
37fi
38
39# Does target volume use slices?
40if [ "$targetDevice" = "$targetDevice#*disk*s" ]; then
41echo "*** ERROR Volume does not use slices. Exiting."
42"$scriptDir"InstallLog.sh "${installerVolume}" "FAIL: $targetVolume doesn't use slices."
43exit 2
44fi
45
46# Check to find if an EFI system partition exists on the disk.
47# This is used in two cases:
48# A) When checking for existing Chameleon installations.
49# B) When the user chooses the EFI system partition install option,
50# and installing to a 'small' HFS device like a 1GB USB flash
51# drive which won't have an EFI System Partition.
52
53# Take target device and check if slice 1 is not named "EFI"
54stripped=$( echo ${targetDevice#/dev/} )
55if [ ! $(echo ${stripped#*disk*s}) = 1 ]; then
56stripped=$( echo ${stripped%s*})"s1"
57fi
58if [ ! $( diskutil list | grep ${stripped} | awk {'print $2'} ) = "EFI" ]; then
59if [ "$targetVolume" = "/Volumes/EFI" ]; then
60"$scriptDir"InstallLog.sh "${installerVolume}" "FAIL: Selected disk does not have an EFI System Partition."
61fi
62exit 1
63fi
64
65exit 0
66

Archive Download this file

Revision: 1751