20macosx 771 B

1234567891011121314151617181920212223242526272829303132
  1. #!/bin/sh -e
  2. # Detects Mac OS X. I don't yet know how Mac OS <= 9 fits into this.
  3. . /usr/share/os-prober/common.sh
  4. partition="$1"
  5. mpoint="$2"
  6. type="$3"
  7. debug() {
  8. if [ -z "$OS_PROBER_DISABLE_DEBUG" ]; then
  9. logger -t macosx-prober "debug: $@"
  10. fi
  11. }
  12. # Weed out stuff that doesn't apply to us
  13. case "$type" in
  14. hfsplus) debug "$1 is an HFS+ partition" ;;
  15. *) debug "$1 is not an HFS+ partition: exiting"; exit 1 ;;
  16. esac
  17. # Could use a better test than this.
  18. # /System/Library/CoreServices/SystemVersion.plist has version information,
  19. # but I don't think it exists on Mac OS <= 9, and it's XML so parsing in
  20. # shell will be nasty.
  21. if [ -e "$2/mach_kernel" ]; then
  22. label="$(count_next_label MacOSX)"
  23. result "$1:Mac OS X:$label:macosx"
  24. exit 0
  25. else
  26. exit 1
  27. fi