Chameleon Applications

Chameleon Applications Svn Source Tree

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

  • Property svn:executable set to *
1#!/bin/bash
2
3echo "==============================================="
4echo "Write Chameleon Stage 2 Loader:"
5echo "*******************************"
6
7
8# for example:
9# espformat code is 1 for HFS, 2 for MSDOS, 0 for unknown
10
11
12if [ "$#" -eq 5 ]; then
13espformat="$1"
14stage2Loader="$2"
15selectedDestination="$3"
16targetDevice="$4"
17targetVolume="$5"
18#targetResources="$6"
19echo "DEBUG: passed argument for espformat = $espformat"
20echo "DEBUG: passed argument for stage2Loader = $stage2Loader"
21echo "DEBUG: passed argument for selectedDestination = $selectedDestination"
22echo "DEBUG: passed argument for targetDevice = $targetDevice"
23echo "DEBUG: passed argument for targetVolume = $targetVolume"
24#echo "DEBUG: passed argument for targetResources = $targetResources"
25fi
26
27# check to see if install to EFI system partition was selected
28# if chosen, the package installer will add a file named 'nullESP'
29# in to the temporary directory /.Chameleon
30
31if [ -f "${selectedDestination}"/.Chameleon/nullESP ]; then
32
33echo "DEBUG: nullESP exists"
34
35#[ -d "${targetVolume}" ] || mkdir -p "${targetVolume}"
36if [ ! -d "${targetVolume}" ]; then
37echo "Executing Command: mkdir -p ${targetVolume}"
38mkdir -p "${targetVolume}"
39else
40echo "DEBUG: folder /Volumes/EFI already exists"
41fi
42
43#if the EFI system partition was selected then
44# mount '/Volumes/EFI' with the correct format type
45
46if [ ${espformat} = 1 ]; then
47
48echo "Executing command: mount_hfs ${targetDevice} ${targetVolume}"
49mount_hfs "${targetDevice}" "${targetVolume}"
50fi
51if [ ${espformat} = 2 ]; then
52[ -d "${targetVolume}" ] || mkdir -p "${targetVolume}"
53echo "Executing command: mount_msdos -u 0 -g 0 ${targetDevice} ${targetVolume}"
54mount_msdos -u 0 -g 0 "${targetDevice}" "${targetVolume}"
55fi
56fi
57
58echo "Executing command: cp ${selectedDestination}/.Chameleon/i386/${stage2Loader} ${targetVolume}"
59cp "${selectedDestination}"/.Chameleon/i386/"${stage2Loader}" "${targetVolume}"
60
61
62
63
64if [ -f "${selectedDestination}"/.Chameleon/nullhideboot ]; then
65
66echo "Executing command: SetFile -a V ${targetVolume}/${stage2Loader}"
67SetFile -a V "${targetVolume}"/"${stage2Loader}"
68fi
69
70echo "-----------------------------------------------"
71echo ""
72echo ""
73
74exit 0

Archive Download this file

Revision: 249