PageRenderTime 21ms CodeModel.GetById 11ms app.highlight 5ms RepoModel.GetById 2ms app.codeStats 0ms

/core/10.4/packaging/macfuse-core/Install_resources/VolumeCheck

http://macfuse.googlecode.com/
Shell | 39 lines | 22 code | 7 blank | 10 comment | 4 complexity | c0a63a2f5741505d9d6d12dfedbc796c MD5 | raw file
 1#!/bin/sh
 2#
 3# Copyright (C) 2006 Google. All Rights Reserved.
 4#
 5# See http://developer.apple.com/documentation/DeveloperTools/Conceptual/SoftwareDistribution4/Concepts/sd_volume_check_ref.html
 6
 7VOLUME=$1
 8
 9VERSION_PATH="/System/Library/CoreServices/SystemVersion"
10
11if [ ! -f "${VOLUME}/${VERSION_PATH}.plist" ]
12then
13  # Volume doesn't appear to have OS X installed.
14  exit 112
15fi
16
17VERSION=`/usr/bin/defaults read "$VOLUME/$VERSION_PATH" ProductVersion`
18if [ x"$VERSION" = x"" ]
19then
20  # Unable to get OS X version from volume.
21  exit 113
22fi
23
24MAJOR=`echo "$VERSION" | /usr/bin/awk -F. '{ print $1 }'`
25MINOR=`echo "$VERSION" | /usr/bin/awk -F. '{ print $2 }'`
26if [ \( x"$MAJOR" = x"" \) -o \( x"$MINOR" = x"" \) ]
27then
28  # Unable to parse OS X version obtained from volume.
29  exit 114
30fi
31
32if [ \( $MAJOR -lt 10 \) -o \( $MINOR -ne 4 \) ]
33then
34  # Requires Mac OS X 10.4.
35  exit 115
36fi
37
38# Success!
39exit 0