Chameleon Applications

Chameleon Applications Svn Source Tree

Root/branches/blackosx/trunk/PackageBuilder/Main_Package_Elements/Scripts/WriteChameleonStage1.sh

  • Property svn:executable set to *
1#!/bin/bash
2
3echo "==============================================="
4echo "Write Chameleon Stage 1 Loader:"
5echo "*******************************"
6
7# espformat code is 1 for HFS, 2 for MSDOS, 0 for unknown
8
9if [ "$#" -eq 6 ]; then
10espformat="$1"
11stage1LoaderHFS="$2"
12stage1LoaderFAT="$3"
13selectedDestination="$4"
14targetDeviceRaw="$5"
15targetVolume="$6"
16echo "DEBUG: passed argument for espformat = $espformat"
17echo "DEBUG: passed argument for stage1LoaderHFS = $stage1LoaderHFS"
18echo "DEBUG: passed argument for stage1LoaderFAT = $stage1LoaderFAT"
19echo "DEBUG: passed argument for selectedDestination = $selectedDestination"
20echo "DEBUG: passed argument for targetDeviceRaw = $targetDeviceRaw"
21echo "DEBUG: passed argument for targetVolume = $targetVolume"
22fi
23
24if [ ${espformat} = "1" ]; then
25# the selected partition is HFS formatted
26
27echo "Executing command: dd if=${selectedDestination}/.Chameleon/i386/${stage1LoaderHFS} of=${targetDeviceRaw}"
28dd if="${selectedDestination}/.Chameleon/i386/${stage1LoaderHFS}" of=${targetDeviceRaw}
29fi
30
31if [ ${espformat} = "2" ]; then
32# the selected partition FAT formatted
33
34# check to see if install to EFI system partition was selected
35# if chosen, the package installer will add a file named 'nullESP'
36# in to the temporary directory /.Chameleon
37
38if [ -f ${selectedDestination}/.Chameleon/nullESP ]; then
39echo "Executing command: dd if=${targetDeviceRaw} count=1 bs=512 of=/tmp/origbs"
40dd if=${targetDeviceRaw} count=1 bs=512 of=/tmp/origbs
41
42echo "Executing command: cp /.Chameleon/i386/${stage1LoaderFAT} /tmp/newbs"
43cp ${selectedDestination}/.Chameleon/i386/${stage1LoaderFAT} /tmp/newbs
44
45echo "Executing command: dd if=/tmp/origbs of=/tmp/newbs skip=3 seek=3 bs=1 count=87 conv=notrunc"
46dd if=/tmp/origbs of=/tmp/newbs skip=3 seek=3 bs=1 count=87 conv=notrunc
47
48echo "Executing command: dd of=${targetDeviceRaw} count=1 bs=512 if=/tmp/newbs"
49dd if=/tmp/newbs of="${targetDeviceRaw}" count=1 bs=512
50else
51echo "Executing command: dd if=/.Chameleon/i386/${stage1LoaderFAT} of=${targetDeviceRaw}"
52dd if="${targetVolume}/.Chameleon/i386/${stage1LoaderFAT}" of=${targetDeviceRaw}
53fi
54fi
55
56echo "-----------------------------------------------"
57echo ""
58
59exit 0
60
61
62
63

Archive Download this file

Revision: 221