Chameleon Applications

Chameleon Applications Svn Source Tree

Root/branches/blackosx/trunk/PackageBuilder/Main_Package_Elements/Scripts/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"
23fi
24
25# check to see if install to EFI system partition was selected
26# if chosen, the package installer will add a file named 'nullESP'
27# in to the temporary directory /.Chameleon
28
29if [ -f ${selectedDestination}/.Chameleon/nullESP ]; then
30
31echo "DEBUG: nullESP exists"
32
33#[ -d "${targetVolume}" ] || mkdir -p "${targetVolume}"
34if [ ! -d "${targetVolume}" ]; then
35echo "Executing Command: mkdir -p ${targetVolume}"
36mkdir -p "${targetVolume}"
37else
38echo "DEBUG: folder /Volumes/EFI already exists"
39fi
40
41#if the EFI system partition was selected then
42# mount '/Volumes/EFI' with the correct format type
43
44if [ ${espformat} = 1 ]; then
45
46echo "Executing command: mount_hfs ${targetDevice} ${targetVolume}"
47mount_hfs "${targetDevice}" "${targetVolume}"
48fi
49if [ ${espformat} = 2 ]; then
50[ -d "${targetVolume}" ] || mkdir -p "${targetVolume}"
51echo "Executing command: mount_msdos -u 0 -g 0 ${targetDevice} ${targetVolume}"
52mount_msdos -u 0 -g 0 "${targetDevice}" "${targetVolume}"
53fi
54fi
55
56echo "Executing command: cp ${selectedDestination}/.Chameleon/i386/${stage2Loader} ${targetVolume}"
57cp "${selectedDestination}/.Chameleon/i386/${stage2Loader}" "${targetVolume}"
58
59#echo "Executing command: ${targetResources}/Tools/SetFile -a V ${targetVolume}/${stage2Loader}"
60#"${targetResources}/Tools/SetFile" -a V "${targetVolume}/${stage2Loader}"
61
62
63echo "-----------------------------------------------"
64echo ""
65echo ""
66
67exit 0

Archive Download this file

Revision: 221