Chameleon

Chameleon Svn Source Tree

Root/branches/blackosx/package/Scripts/Install/CheckWindowsDiskSignature.sh

  • Property svn:executable set to *
1#!/bin/bash
2
3echo "==============================================="
4echo "CheckWindowsDiskSignature: Is Windows installed?"
5echo "************************************************"
6
7# Checks the disk sector for a 4-byte Windows disk signature
8# if one is found then it exits with 1, otherwise it exits with 0
9
10# Receives targetdisk: for example, /dev/disk0
11
12
13if [ "$#" -eq 1 ]; then
14targetDisk="$1"
15echo "DEBUG: passed argument for targetDisk = $targetDisk"
16else
17echo "Error - wrong number of values passed - Exiting"
18exit 9
19fi
20
21disksignature=$( dd 2>/dev/null if="$targetDisk" count=1 | dd 2>/dev/null count=4 bs=1 skip=440 | perl -ne '@a=split"";for(@a){printf"%02x",ord}' )
22
23#echo "${disksignature}"
24
25if [ "${disksignature}" = "00000000" ]; then
26echo "No Windows installation detected."
27echo "-----------------------------------------------"
28echo ""
29exit 0
30else
31echo "Detected an existing Windows installation"
32echo "-----------------------------------------------"
33echo ""
34exit 1
35fi
36
37echo "-----------------------------------------------"
38echo ""
39
40exit 0

Archive Download this file

Revision: 1545