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"
24
25fi
26
27if [ ${diskSigCheck} == "0" ]; then
28echo "DEBUG: Windows is not installed so let's change the active partition"
29
30partitionactive=$( "${targetVolume}"/.Chameleon/i386/fdisk440 -d ${targetDiskRaw} | grep -n "*" | awk -F: '{print $1}')
31echo "Current Active Partition: ${partitionactive}"
32
33if [ "${partitionactive}" = "${targetSlice}" ]; then
34echo "${targetVolume} is already flagged as active"
35else
36echo "${targetVolume} is not flagged as active, so let's do it."
37# BadAxe requires EFI partition to be flagged active.
38# but it doesn't' hurt to do it for any non-windows partition.
39
40"${targetVolume}"/.Chameleon/i386/fdisk440 -e ${targetDiskRaw} <<-MAKEACTIVE
41print
42flag ${targetSlice}
43write
44y
45quit
46MAKEACTIVE
47fi
48else
49echo "Windows is installed so we let that remain the active partition"
50fi
51
52echo "-----------------------------------------------"
53echo ""
54echo ""
55
56exit 0
57
58
59
60

Archive Download this file

Revision: 247