_distp_lsb.sh.skel 822B

123456789101112131415161718192021222324252627282930313233343536
  1. #!/bin/bash
  2. shellfu import pretty
  3. #
  4. # dist.sh module to query lsb_release command
  5. #
  6. _distp_lsb__get() {
  7. #
  8. # Get field from lsb_release
  9. #
  10. local key=$1
  11. case $key in
  12. id) lsb_release -si | tr '[:upper:]' '[:lower:]' ;;
  13. description) lsb_release -sd ;;
  14. name) lsb_release -si ;;
  15. ver) lsb_release -sr ;;
  16. ver.x) lsb_release -sr | cut -d. -f1 ;;
  17. ver.y) lsb_release -sr | cut -d. -f2 ;;
  18. ver.z) : ;;
  19. codename) lsb_release -sc ;;
  20. "") mkusage -E KEY ;;
  21. *) return 1 ;;
  22. esac
  23. return 0
  24. }
  25. _distp_lsb__sfpi_compat() {
  26. #
  27. # True if this plugin should work here
  28. #
  29. command -v lsb_release >/dev/null
  30. }
  31. #shellfu module-version=__MKIT_PROJ_VERSION__