Chameleon

Chameleon Svn Source Tree

Root/branches/blackosx/package/Scripts/Install/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 6 ]; then
13efiformat="$1"
14diskSigCheck="$2"
15targetDiskRaw="$3"
16targetSlice="$4"
17targetVolume="$5"
18scriptDir="$6"
19
20echo "DEBUG: passed argument for efiformat = $efiformat"
21echo "DEBUG: passed argument for diskSigCheck = $diskSigCheck"
22echo "DEBUG: passed argument for targetDiskRaw = $targetDiskRaw"
23echo "DEBUG: passed argument for targetSlice = $targetSlice"
24echo "DEBUG: passed argument for targetVolume = $targetVolume"
25echo "DEBUG: passed argument for scriptDir = $scriptDir"
26else
27echo "Error - wrong number of values passed"
28exit 9
29fi
30
31if [ ${diskSigCheck} == "0" ]; then
32echo "DEBUG: Windows is not installed so let's change the active partition"
33
34partitionactive=$( "${scriptDir}"/Tools/fdisk440 -d ${targetDiskRaw} | grep -n "*" | awk -F: '{print $1}')
35echo "Current Active Partition: ${partitionactive}"
36
37if [ "${partitionactive}" = "${targetSlice}" ]; then
38echo "${targetVolume} is already flagged as active"
39else
40echo "${targetVolume} is not flagged as active, so let's do it."
41# BadAxe requires EFI partition to be flagged active.
42# but it doesn't' hurt to do it for any non-windows partition.
43
44"${scriptDir}"/Tools/fdisk440 -e ${targetDiskRaw} <<-MAKEACTIVE
45print
46flag ${targetSlice}
47write
48y
49quit
50MAKEACTIVE
51fi
52else
53echo "Windows is installed so we let that remain the active partition"
54fi
55
56echo "-----------------------------------------------"
57echo ""
58echo ""
59
60exit 0
61
62
63
64

Archive Download this file

Revision: 1534