83haiku 883 B

1234567891011121314151617181920212223242526272829303132333435
  1. #!/bin/sh
  2. # Detects Haiku on BeFS partitions.
  3. . /usr/share/os-prober/common.sh
  4. partition="$1"
  5. mpoint="$2"
  6. type="$3"
  7. # Weed out stuff that doesn't apply to us
  8. case "$type" in
  9. befs|befs_be) debug "$partition is a BeFS partition" ;;
  10. *) debug "$partition is not a BeFS partition: exiting"; exit 1 ;;
  11. esac
  12. if head -c 512 "$partition" | grep -qs "system.haiku_loader"; then
  13. debug "Stage 1 bootloader found"
  14. else
  15. debug "Stage 1 bootloader not found: exiting"
  16. exit 1
  17. fi
  18. if system="$(item_in_dir "system" "$mpoint")" &&
  19. item_in_dir -q "haiku_loader" "$mpoint/$system" &&
  20. (item_in_dir -q "kernel_x86" "$mpoint/$system" ||
  21. item_in_dir -q "kernel_x86_64" "$mpoint/$system")
  22. then
  23. debug "Stage 2 bootloader and kernel found"
  24. label="$(count_next_label Haiku)"
  25. result "$partition:Haiku:$label:chain"
  26. exit 0
  27. else
  28. debug "Stage 2 bootloader and kernel not found: exiting"
  29. exit 1
  30. fi