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
36# if chosen, the package installer will add a file named 'nullESP'
37# in to the temporary directory /.Chameleon
38
39if [ "${selectedDestination}" = "/Volumes/EFI" ]; then
40echo "DEBUG: EFI install chosen"
41
42if [ ! -d "${selectedDestination}" ]; then
43echo "Executing Command: mkdir -p ${selectedDestination}"
44mkdir -p "${targetVolume}"
45else
46echo "DEBUG: folder /Volumes/EFI already exists"
47fi
48
49#if the EFI system partition was selected then
50# mount '/Volumes/EFI' with the correct format type
51
52if [ ${espformat} = 1 ]; then
53
54echo "Executing command: mount_hfs ${targetDevice} ${targetVolume}"
55mount_hfs "${targetDevice}" "${targetVolume}"
56fi
57if [ ${espformat} = 2 ]; then
58[ -d "${selectedDestination}" ] || mkdir -p "${selectedDestination}"
59echo "Executing command: mount_msdos -u 0 -g 0 ${targetDevice} ${selectedDestination}"
60mount_msdos -u 0 -g 0 "${targetDevice}" "${selectedDestination}"
61fi
62
63echo "Executing command: cp "${targetVolume}"/usr/standalone/i386/${stage2Loader} ${selectedDestination}"
64cp "${targetVolume}"/usr/standalone/i386/"${stage2Loader}" "${selectedDestination}"
65"$scriptDir"InstallLog.sh "${targetVolume}" "Written boot to ${selectedDestination}."
66else
67echo "Executing command: cp "${targetVolume}"/usr/standalone/i386/${stage2Loader} ${targetVolume}"
68cp "${targetVolume}"/usr/standalone/i386/"${stage2Loader}" "${targetVolume}"
69"$scriptDir"InstallLog.sh "${targetVolume}" "Written boot to ${targetVolume}."
70fi
71
72
73
74
75
76#if [ -f "${selectedDestination}"/.Chameleon/nullhideboot ]; then
77#
78#echo "Executing command: SetFile -a V ${targetVolume}/${stage2Loader}"
79#"${selectedDestination}"/.Chameleon//Tools/SetFile -a V "${targetVolume}"/"${stage2Loader}"
80#fi
81
82echo "-----------------------------------------------"
83echo ""
84echo ""
85
86exit 0

Archive Download this file

Revision: 1557