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
34echo "Executing command: dd if=${targetDeviceRaw} count=1 bs=512 of=/tmp/origbs"
35dd if=${targetDeviceRaw} count=1 bs=512 of=/tmp/origbs
36
37echo "Executing command: cp cp ${selectedDestination}/.Chameleon/i386/${stage1LoaderFAT} /tmp/newbs"
38cp "${selectedDestination}"/.Chameleon/i386/${stage1LoaderFAT} /tmp/newbs
39
40echo "Executing command: dd if=/tmp/origbs of=/tmp/newbs skip=3 seek=3 bs=1 count=87 conv=notrunc"
41dd if=/tmp/origbs of=/tmp/newbs skip=3 seek=3 bs=1 count=87 conv=notrunc
42
43echo "Executing command: dd of=${targetDeviceRaw} count=1 bs=512 if=/tmp/newbs"
44dd if=/tmp/newbs of="${targetDeviceRaw}" count=1 bs=512
45
46fi
47
48echo "-----------------------------------------------"
49echo ""
50
51exit 0
52
53
54
55

Archive Download this file

Revision: 252