Chameleon

Chameleon Svn Source Tree

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

  • Property svn:executable set to *
1#!/bin/bash
2
3echo "==============================================="
4echo "Write Chameleon Stage 2 Loader:"
5echo "*******************************"
6
7# Writes Chameleon stage 2 loader.
8
9# Receives espformat: 1 for HFS, 2 for MSDOS, 0 for unknown
10# Receives stage2Loader: Name of file - boot
11# Receives selectedDestination: for example, /Volumes/USB
12# Receives targetDevice: for example, /dev/disk3s1
13# Receives targetVolume: for example, /Volumes/USB
14# Receives scriptDir: The location of the main script dir.
15
16
17if [ "$#" -eq 6 ]; then
18espformat="$1"
19stage2Loader="$2"
20selectedDestination="$3"
21targetDevice="$4"
22targetVolume="$5"
23scriptDir="$6"
24echo "DEBUG: passed argument for espformat = $espformat"
25echo "DEBUG: passed argument for stage2Loader = $stage2Loader"
26echo "DEBUG: passed argument for selectedDestination = $selectedDestination"
27echo "DEBUG: passed argument for targetDevice = $targetDevice"
28echo "DEBUG: passed argument for targetVolume = $targetVolume"
29echo "DEBUG: passed argument for scriptDir = $scriptDir"
30else
31echo "Error - wrong number of values passed"
32exit 9
33fi
34
35# check to see if install to EFI system partition was selected
36if [ "${selectedDestination}" = "/Volumes/EFI" ]; then
37echo "DEBUG: EFI install chosen"
38
39if [ ! -d "${selectedDestination}" ]; then
40echo "Executing Command: mkdir -p ${selectedDestination}"
41mkdir -p "${targetVolume}"
42else
43echo "DEBUG: folder /Volumes/EFI already exists"
44fi
45
46#if the EFI system partition was selected then
47# mount '/Volumes/EFI' with the correct format type
48
49if [ ${espformat} = 1 ]; then
50
51echo "Executing command: mount_hfs ${targetDevice} ${targetVolume}"
52mount_hfs "${targetDevice}" "${targetVolume}"
53fi
54if [ ${espformat} = 2 ]; then
55[ -d "${selectedDestination}" ] || mkdir -p "${selectedDestination}"
56echo "Executing command: mount_msdos -u 0 -g 0 ${targetDevice} ${selectedDestination}"
57mount_msdos -u 0 -g 0 "${targetDevice}" "${selectedDestination}"
58fi
59
60echo "Executing command: cp "${targetVolume}"/usr/standalone/i386/${stage2Loader} ${selectedDestination}"
61cp "${targetVolume}"/usr/standalone/i386/"${stage2Loader}" "${selectedDestination}"
62"$scriptDir"InstallLog.sh "${targetVolume}" "Written boot to ${selectedDestination}."
63else
64echo "Executing command: cp "${targetVolume}"/usr/standalone/i386/${stage2Loader} ${targetVolume}"
65cp "${targetVolume}"/usr/standalone/i386/"${stage2Loader}" "${targetVolume}"
66"$scriptDir"InstallLog.sh "${targetVolume}" "Written boot to ${targetVolume}."
67fi
68
69
70#if [ -f "${selectedDestination}"/.Chameleon/nullhideboot ]; then
71#echo "Executing command: SetFile -a V ${targetVolume}/${stage2Loader}"
72#"${selectedDestination}"/.Chameleon/Resources/SetFile -a V "${targetVolume}"/"${stage2Loader}"
73#fi
74
75echo "-----------------------------------------------"
76echo ""
77echo ""
78
79exit 0

Archive Download this file

Revision: 1562