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 [ "${targetVolume}" = "/Volumes/EFI" ]; then
40echo "DEBUG: EFI install chosen"
41
42if [ ! -d "${targetVolume}" ]; then
43echo "Executing Command: mkdir -p ${targetVolume}"
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 "${targetVolume}" ] || mkdir -p "${targetVolume}"
59echo "Executing command: mount_msdos -u 0 -g 0 ${targetDevice} ${targetVolume}"
60mount_msdos -u 0 -g 0 "${targetDevice}" "${targetVolume}"
61fi
62
63echo "Executing command: cp "${selectedDestination}"/usr/standalone/i386/${stage2Loader} ${targetVolume}"
64cp "${selectedDestination}"/usr/standalone/i386/"${stage2Loader}" "${targetVolume}"
65else
66echo "Executing command: cp "${targetVolume}"/usr/standalone/i386/${stage2Loader} ${targetVolume}"
67cp "${targetVolume}"/usr/standalone/i386/"${stage2Loader}" "${targetVolume}"
68fi
69
70"$scriptDir"InstallLog.sh "${targetVolume}" "Written boot to ${targetVolume}."
71
72
73
74#if [ -f "${selectedDestination}"/.Chameleon/nullhideboot ]; then
75#
76#echo "Executing command: SetFile -a V ${targetVolume}/${stage2Loader}"
77#"${selectedDestination}"/.Chameleon//Tools/SetFile -a V "${targetVolume}"/"${stage2Loader}"
78#fi
79
80echo "-----------------------------------------------"
81echo ""
82echo ""
83
84exit 0

Archive Download this file

Revision: 1545