1 | #!/bin/bash␊ |
2 | ␊ |
3 | echo "==============================================="␊ |
4 | echo "Write Chameleon Stage 2 Loader:"␊ |
5 | echo "*******************************"␊ |
6 | ␊ |
7 | # Receives stage2Loader: Name of file - boot␊ |
8 | # Receives selectedDestination: for example, /Volumes/ChameleonBootUSB (or /Volumes/EFI if ESP install).␊ |
9 | # Receives targetDevice: for example, /dev/disk3s1␊ |
10 | # Receives targetVolume: for example, /Volumes/ChameleonBootUSB␊ |
11 | # Receives scriptDir: The location of the main script dir.␊ |
12 | ␊ |
13 | ␊ |
14 | if [ "$#" -eq 5 ]; then␊ |
15 | ␉stage2Loader="$1"␊ |
16 | ␉selectedDestination="$2"␊ |
17 | ␉targetDevice="$3"␊ |
18 | ␉targetVolume="$4"␊ |
19 | ␉scriptDir="$5"␊ |
20 | ␉echo "DEBUG: passed argument for stage2Loader = $stage2Loader"␊ |
21 | ␉echo "DEBUG: passed argument for selectedDestination = $selectedDestination"␊ |
22 | ␉echo "DEBUG: passed argument for targetDevice = $targetDevice"␊ |
23 | ␉echo "DEBUG: passed argument for targetVolume = $targetVolume"␊ |
24 | ␉echo "DEBUG: passed argument for scriptDir = $scriptDir"␊ |
25 | else␊ |
26 | ␉echo "Error - wrong number of values passed"␊ |
27 | ␉exit 9␊ |
28 | fi␊ |
29 | ␊ |
30 | # check to see if install to EFI system partition was selected␊ |
31 | if [ "${selectedDestination}" = "/Volumes/EFI" ]; then␊ |
32 | ␉#echo "DEBUG: Executing command: cp "${targetVolume}"/usr/standalone/i386/${stage2Loader} ${selectedDestination}"␊ |
33 | ␉cp "${targetVolume}"/usr/standalone/i386/"${stage2Loader}" "${selectedDestination}"␊ |
34 | ␉"$scriptDir"InstallLog.sh "${targetVolume}" "Written boot to ${selectedDestination}."␊ |
35 | else␊ |
36 | ␉#echo "DEBUG: Executing command: cp "${targetVolume}"/usr/standalone/i386/${stage2Loader} ${targetVolume}"␊ |
37 | ␉cp "${targetVolume}"/usr/standalone/i386/"${stage2Loader}" "${targetVolume}"␊ |
38 | ␉"$scriptDir"InstallLog.sh "${targetVolume}" "Written boot to ${targetVolume} on ${targetDevice}."␊ |
39 | fi␊ |
40 | ␊ |
41 | |
42 | #if [ -f "${selectedDestination}"/.Chameleon/nullhideboot ]; then␊ |
43 | #␉echo "Executing command: SetFile -a V ${targetVolume}/${stage2Loader}"␊ |
44 | #␉"${selectedDestination}"/.Chameleon/Resources/SetFile -a V "${targetVolume}"/"${stage2Loader}"␊ |
45 | #fi␊ |
46 | ␊ |
47 | exit 0␊ |
48 | |