40lsb 891 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #!/bin/sh
  2. # Test for LSB systems.
  3. set -e
  4. . /usr/share/os-prober/common.sh
  5. partition="$1"
  6. dir="$2"
  7. type="$3"
  8. lsb_field () {
  9. file="$1"
  10. field="$2"
  11. grep ^"$field" "$file" | cut -d = -f 2 | sed 's/^"//' | sed 's/"$//' | sed 's/:/ /g'
  12. }
  13. file="$dir/etc/lsb-release"
  14. if [ ! -e "$file" ]; then
  15. exit 1
  16. fi
  17. release=$(lsb_field "$file" DISTRIB_RELEASE)
  18. if [ -z "$release" ]; then
  19. release=$(lsb_field "$file" DISTRIB_CODENAME)
  20. fi
  21. description=$(lsb_field "$file" DISTRIB_DESCRIPTION)
  22. if [ -z "$description" ]; then
  23. description=$(lsb_field "$file" DISTRIB_CODENAME)
  24. fi
  25. if [ -n "$description" ]; then
  26. if [ -n "$release" ]; then
  27. long="$description ($release)"
  28. else
  29. long="$description"
  30. fi
  31. else
  32. exit 1
  33. fi
  34. short=$(lsb_field "$file" DISTRIB_ID | sed 's/ //g')
  35. if [ -z "$short" ]; then
  36. short="UnknownLSB"
  37. fi
  38. label="$(count_next_label "$short")"
  39. result "$partition:$long:$label:linux"
  40. exit 0