Chameleon

Chameleon Svn Source Tree

Root/branches/ErmaC/Modules/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
10# Receives targetVolume: Volume to install to (will be '/Volumes/EFI' if EFI install)
11# Receives targetDevice: Stores device number, for example /dev/disk2s1.
12# Receives installerVolume: Volume to write the installer log to.
13# Receives scriptDir: The location of the main script dir.
14
15if [ "$#" -eq 4 ]; then
16targetVolume="$1"
17targetDevice="$2"
18installerVolume="$3"
19scriptDir="$4"
20echo "DEBUG: passed argument for targetVolume = $targetVolume"
21echo "DEBUG: passed argument for targetDevice = $targetDevice"
22echo "DEBUG: passed argument for installerVolume = $installerVolume"
23echo "DEBUG: passed argument for scriptDir = $scriptDir"
24else
25echo "Error - wrong number of values passed"
26exit 9
27fi
28
29
30# Does target volume exist?
31if [ -z "$targetVolume" ]; then
32echo "*** Cannot find the volume. Exiting."
33"$scriptDir"InstallLog.sh "${installerVolume}" "FAIL: Cannot file the volume: $targetVolume."
34exit 1
35#else
36#echo "DEBUG: Confirming target volume exists"
37fi
38
39
40# Does target volume use slices?
41if [ "$targetDevice" = "$targetDevice#*disk*s" ]; then
42echo "*** ERROR Volume does not use slices. Exiting."
43"$scriptDir"InstallLog.sh "${installerVolume}" "FAIL: $targetVolume doesn't use slices."
44exit 1
45#else
46#echo "DEBUG: Confirming target device uses slices"
47fi
48
49
50# Add check for installing to a 'small' HFS device like a
51# 1GB USB flash drive which won't have an EFI System Partition.
52if [ "$targetVolume" = "/Volumes/EFI" ]; then
53# Take target device and check slice 1 matches partition 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
59#echo "DEBUG: *** The selected volume doesn't have an EFI System Partition. Exiting."
60"$scriptDir"InstallLog.sh "${installerVolume}" "FAIL: Selected disk does not have an EFI System Partition."
61exit 1
62fi
63fi
64
65exit 0
66

Archive Download this file

Revision: 1631