Chameleon Applications

Chameleon Applications Svn Source Tree

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

  • Property svn:executable set to *
1#!/bin/bash
2
3echo "==============================================="
4echo "Checkdisksignature:"
5echo "********************"
6
7# this script is passed the targetdisk to work from, for example /dev/disk0
8# It then checks the disk sector for a 4-byte Windows disk signature
9# if one is found then it exits with 1, otherwise it exits with 0
10
11if [ "$#" -eq 1 ]; then
12targetDisk="$1"
13echo "DEBUG: passed argument for targetDisk = $targetDisk"
14else
15echo "Error - wrong number of values passed - Exiting"
16exit 9
17fi
18
19disksignature=$( 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}' )
20
21echo "${disksignature}"
22
23if [ $disksignature = "00000000" ]; then
24echo "No Windows installation detected."
25echo "-----------------------------------------------"
26echo ""
27exit 0
28else
29echo "Detected an existing Windows installation"
30echo "-----------------------------------------------"
31echo ""
32exit 1
33fi
34
35echo "-----------------------------------------------"
36echo ""
37
38exit 0

Archive Download this file

Revision: 221