aoe-version 997 B

12345678910111213141516171819202122232425262728293031323334
  1. #! /bin/sh
  2. # aoe-version - display versions of AoE-related software
  3. # Copyright 2007, Coraid, Inc., and licensed under GPL v.2.
  4. aoetools=21
  5. # standalone aoe drivers have a module parameter "version"
  6. installed="`modinfo aoe 2>/dev/null | awk '/srcversion/ {next} /^parm:.*version:aoe module/ {print $NF; exit 0}'`"
  7. if test -z "$installed"; then
  8. # Recent kernels have a "version" of their own, so
  9. # they didn't want our module parameter, so we look
  10. # for that, too, in case user is using kernel.org driver.
  11. installed="`modinfo aoe 2>/dev/null | awk '/^version:/ {print $NF; exit 0}'`"
  12. fi
  13. if test "$?" != "0" || test -z "$installed"; then
  14. installed="(unknown)"
  15. fi
  16. if test -d /sys/module/aoe; then
  17. running="`find /sys/module/aoe -name version | xargs cat`"
  18. if test "$?" != "0"; then
  19. running="(unknown)"
  20. fi
  21. else
  22. running="(none)"
  23. fi
  24. while read val desc; do
  25. printf "%22s:\t%s\n" "$desc" "$val"
  26. done <<EOF
  27. $aoetools aoetools
  28. $installed installed aoe driver
  29. $running running aoe driver
  30. EOF