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"
22else
23echo "Error - wrong number of values passed"
24exit 9
25fi
26
27if [ ${espformat} = "1" ]; then
28# the selected partition is HFS formatted
29
30echo "Executing command: dd if=${selectedDestination}/.Chameleon/i386/${stage1LoaderHFS} of=${targetDeviceRaw}"
31dd if="${selectedDestination}/.Chameleon/i386/${stage1LoaderHFS}" of=${targetDeviceRaw}
32fi
33
34if [ ${espformat} = "2" ]; then
35# the selected partition FAT formatted
36
37echo "Executing command: dd if=${targetDeviceRaw} count=1 bs=512 of=/tmp/origbs"
38dd if=${targetDeviceRaw} count=1 bs=512 of=/tmp/origbs
39
40echo "Executing command: cp cp ${selectedDestination}/.Chameleon/i386/${stage1LoaderFAT} /tmp/newbs"
41cp "${selectedDestination}"/.Chameleon/i386/${stage1LoaderFAT} /tmp/newbs
42
43echo "Executing command: dd if=/tmp/origbs of=/tmp/newbs skip=3 seek=3 bs=1 count=87 conv=notrunc"
44dd if=/tmp/origbs of=/tmp/newbs skip=3 seek=3 bs=1 count=87 conv=notrunc
45
46echo "Executing command: dd of=${targetDeviceRaw} count=1 bs=512 if=/tmp/newbs"
47dd if=/tmp/newbs of="${targetDeviceRaw}" count=1 bs=512
48
49fi
50
51echo "-----------------------------------------------"
52echo ""
53
54exit 0
55
56
57
58

Archive Download this file

Revision: 255