/core/packaging/macfuse/Install_resources/VolumeCheck

http://macfuse.googlecode.com/ · Shell · 39 lines · 22 code · 7 blank · 10 comment · 4 complexity · bb92fd7b26c7057085dfc1b5b1bce977 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. VOLUME=$1
  7. VERSION_PATH="/System/Library/CoreServices/SystemVersion"
  8. if [ ! -f "${VOLUME}/${VERSION_PATH}.plist" ]
  9. then
  10. # Volume doesn't appear to have OS X installed.
  11. exit 112
  12. fi
  13. VERSION=`/usr/bin/defaults read "$VOLUME/$VERSION_PATH" ProductVersion`
  14. if [ x"$VERSION" = x"" ]
  15. then
  16. # Unable to get OS X version from volume.
  17. exit 113
  18. fi
  19. MAJOR=`echo "$VERSION" | /usr/bin/awk -F. '{ print $1 }'`
  20. MINOR=`echo "$VERSION" | /usr/bin/awk -F. '{ print $2 }'`
  21. if [ \( x"$MAJOR" = x"" \) -o \( x"$MINOR" = x"" \) ]
  22. then
  23. # Unable to parse OS X version obtained from volume.
  24. exit 114
  25. fi
  26. if [ \( $MAJOR -lt 10 \) -o \( $MINOR -lt 4 \) ]
  27. then
  28. # Requires Mac OS X 10.4 or greater.
  29. exit 115
  30. fi
  31. # Success!
  32. exit 0