1 | #!/bin/bash␊ |
2 | ␊ |
3 | echo "==============================================="␊ |
4 | echo "Write Chameleon Stage 0 Loader:"␊ |
5 | echo "*******************************"␊ |
6 | ␊ |
7 | # Writes Chameleon stage 0 loader.␊ |
8 | ␊ |
9 | # Receives disksignature: 0 = Windows not found, 1 = Windows Found␊ |
10 | # Receives stage0Loader: Name of file - boot0␊ |
11 | # Receives stage0Loaderdualboot: Name of file - boot0hfs␊ |
12 | # Receives targetDisk: for example, /dev/disk3␊ |
13 | # Receives targetVolume: for example, /Volumes/USB␊ |
14 | # Receives scriptDir: The location of the main script dir.␊ |
15 | ␊ |
16 | ␊ |
17 | if [ "$#" -eq 6 ]; then␊ |
18 | ␉disksignature="$1"␊ |
19 | ␉stage0Loader="$2"␊ |
20 | ␉stage0Loaderdualboot="$3"␊ |
21 | ␉targetDisk="$4"␊ |
22 | ␉targetVolume="$5"␊ |
23 | ␉scriptDir="$6"␊ |
24 | ␉echo "DEBUG: passed argument for disksignature = $disksignature"␊ |
25 | ␉echo "DEBUG: passed argument for stage0Loader = $stage0Loader"␊ |
26 | ␉echo "DEBUG: passed argument for stage0Loaderdualboot = $stage0Loaderdualboot"␊ |
27 | ␉echo "DEBUG: passed argument for targetDisk = $targetDisk"␊ |
28 | ␉echo "DEBUG: passed argument for targetVolume = $targetVolume"␊ |
29 | ␉echo "DEBUG: passed argument for scriptDir = $scriptDir"␊ |
30 | else␊ |
31 | ␉echo "Error - wrong number of values passed"␊ |
32 | ␉exit 9␊ |
33 | fi␊ |
34 | ␊ |
35 | ␊ |
36 | if [ ${disksignature} = "0" ]; then␊ |
37 | |
38 | ␉␉␊ |
39 | ␉echo "Executing command: fdisk440 -u -f /usr/standalone/i386/${stage0Loader} -y ${targetDisk}"␊ |
40 | ␉"${scriptDir}"/Tools/fdisk440 -u -f "${targetVolume}"/usr/standalone/i386/${stage0Loader} -y ${targetDisk}␊ |
41 | ␉"$scriptDir"InstallLog.sh "${targetVolume}" "Written boot0 to ${targetDisk}."␊ |
42 | else␊ |
43 | ␉# Windows is also installed on the HDD so we need to write boot0hfs␊ |
44 | ␉␉␊ |
45 | ␉echo "Executing command: /fdisk440 -u -f /usr/standalone/i386/${stage0Loaderdualboot} -y ${targetDisk}"␊ |
46 | ␉"${scriptDir}"/Tools/fdisk440 -u -f "${targetVolume}"/usr/standalone/i386/${stage0Loaderdualboot} -y ${targetDisk}␊ |
47 | ␉"$scriptDir"InstallLog.sh "${targetVolume}" "Written boot0hfs to ${targetDisk}."␊ |
48 | fi␊ |
49 | ␊ |
50 | ␊ |
51 | echo "-----------------------------------------------"␊ |
52 | echo ""␊ |
53 | echo ""␊ |
54 | ␊ |
55 | exit 0 |