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
8# for example:
9# espformat code is 1 for HFS, 2 for MSDOS, 0 for unknown
10
11
12if [ "$#" -eq 5 ]; then
13espformat="$1"
14stage2Loader="$2"
15selectedDestination="$3"
16targetDevice="$4"
17targetVolume="$5"
18echo "DEBUG: passed argument for espformat = $espformat"
19echo "DEBUG: passed argument for stage2Loader = $stage2Loader"
20echo "DEBUG: passed argument for selectedDestination = $selectedDestination"
21echo "DEBUG: passed argument for targetDevice = $targetDevice"
22echo "DEBUG: passed argument for targetVolume = $targetVolume"
23else
24echo "Error - wrong number of values passed"
25exit 9
26fi
27
28# check to see if install to EFI system partition was selected
29# if chosen, the package installer will add a file named 'nullESP'
30# in to the temporary directory /.Chameleon
31
32#if [ -f "${selectedDestination}"/.Chameleon/nullESP ]; then
33if [ "${targetVolume}" = "/Volumes/EFI" ]; then
34echo "DEBUG: EFI install chosen"
35
36if [ ! -d "${targetVolume}" ]; then
37echo "Executing Command: mkdir -p ${targetVolume}"
38mkdir -p "${targetVolume}"
39else
40echo "DEBUG: folder /Volumes/EFI already exists"
41fi
42
43#if the EFI system partition was selected then
44# mount '/Volumes/EFI' with the correct format type
45
46if [ ${espformat} = 1 ]; then
47
48echo "Executing command: mount_hfs ${targetDevice} ${targetVolume}"
49mount_hfs "${targetDevice}" "${targetVolume}"
50fi
51if [ ${espformat} = 2 ]; then
52[ -d "${targetVolume}" ] || mkdir -p "${targetVolume}"
53echo "Executing command: mount_msdos -u 0 -g 0 ${targetDevice} ${targetVolume}"
54mount_msdos -u 0 -g 0 "${targetDevice}" "${targetVolume}"
55fi
56
57echo "Executing command: cp "${selectedDestination}"/usr/standalone/i386/${stage2Loader} ${targetVolume}"
58cp "${selectedDestination}"/usr/standalone/i386/"${stage2Loader}" "${targetVolume}"
59else
60echo "Executing command: cp "${targetVolume}"/usr/standalone/i386/${stage2Loader} ${targetVolume}"
61cp "${targetVolume}"/usr/standalone/i386/"${stage2Loader}" "${targetVolume}"
62fi
63
64
65
66
67#if [ -f "${selectedDestination}"/.Chameleon/nullhideboot ]; then
68#
69#echo "Executing command: SetFile -a V ${targetVolume}/${stage2Loader}"
70#"${selectedDestination}"/.Chameleon//Tools/SetFile -a V "${targetVolume}"/"${stage2Loader}"
71#fi
72
73echo "-----------------------------------------------"
74echo ""
75echo ""
76
77exit 0

Archive Download this file

Revision: 1534