Chameleon Applications

Chameleon Applications Svn Source Tree

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

  • Property svn:executable set to *
1#!/bin/bash
2
3echo "==============================================="
4echo "Set Active Partition ONLY if Windows is not installed"
5echo "*****************************************************"
6
7
8# for example:
9# efiformat code is 1 for HFS, 2 for MSDOS, 0 for unknown
10# diskSigCheck code is 1 for a Windows install, 0 for no Windows install
11
12if [ "$#" -eq 5 ]; then
13efiformat="$1"
14diskSigCheck="$2"
15targetDiskRaw="$3"
16targetSlice="$4"
17targetVolume="$5"
18
19echo "DEBUG: passed argument for efiformat = $efiformat"
20echo "DEBUG: passed argument for diskSigCheck = $diskSigCheck"
21echo "DEBUG: passed argument for targetDiskRaw = $targetDiskRaw"
22echo "DEBUG: passed argument for targetSlice = $targetSlice"
23echo "DEBUG: passed argument for targetVolume = $targetVolume"
24else
25echo "Error - wrong number of values passed"
26exit 9
27fi
28
29if [ ${diskSigCheck} == "0" ]; then
30echo "DEBUG: Windows is not installed so let's change the active partition"
31
32partitionactive=$( "${targetVolume}"/.Chameleon/i386/fdisk440 -d ${targetDiskRaw} | grep -n "*" | awk -F: '{print $1}')
33echo "Current Active Partition: ${partitionactive}"
34
35if [ "${partitionactive}" = "${targetSlice}" ]; then
36echo "${targetVolume} is already flagged as active"
37else
38echo "${targetVolume} is not flagged as active, so let's do it."
39# BadAxe requires EFI partition to be flagged active.
40# but it doesn't' hurt to do it for any non-windows partition.
41
42"${targetVolume}"/.Chameleon/i386/fdisk440 -e ${targetDiskRaw} <<-MAKEACTIVE
43print
44flag ${targetSlice}
45write
46y
47quit
48MAKEACTIVE
49fi
50else
51echo "Windows is installed so we let that remain the active partition"
52fi
53
54echo "-----------------------------------------------"
55echo ""
56echo ""
57
58exit 0
59
60
61
62

Archive Download this file

Revision: 255