OpenSDE Framework (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.3 KiB

  1. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  2. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  3. #
  4. # Filename: lib/sde-package/hives.in
  5. # Copyright (C) 2008 The OpenSDE Project
  6. #
  7. # More information can be found in the files COPYING and README.
  8. #
  9. # This program is free software; you can redistribute it and/or modify
  10. # it under the terms of the GNU General Public License as published by
  11. # the Free Software Foundation; version 2 of the License. A copy of the
  12. # GNU General Public License can be found in the file COPYING.
  13. # --- SDE-COPYRIGHT-NOTE-END ---
  14. # returns the list of available hives
  15. package_hives_list()
  16. {
  17. local hive=
  18. for hive in "$SDEROOT/lib/sde-package/hives"/*; do
  19. if [ -x "$hive" ]; then
  20. echo "$hive"
  21. fi
  22. done | sed -e 's,^.*/,,'
  23. }
  24. # translates an alias into the hive name
  25. package_hive_alias()
  26. {
  27. local hive=
  28. if [ -x "$SDEROOT/lib/sde-package/hives/$1" ]; then
  29. # the original name was given
  30. echo "$1"
  31. else
  32. for hive in $( package_hives_list ); do
  33. if grep -q "^#Alias: $1$" "$SDEROOT/lib/sde-package/hives/$hive"; then
  34. echo "$hive"
  35. return
  36. fi
  37. done
  38. fi
  39. }
  40. package_hive_desc()
  41. {
  42. sed -n -e 's,^#Description: \(.*\)$,\1,p' "$SDEROOT/lib/sde-package/hives/$1" | head -n 1
  43. }
  44. package_hive_aliases()
  45. {
  46. sed -n -e 's,^#Alias: \([^ ]*\)$,\1,p' "$SDEROOT/lib/sde-package/hives/$1" | tr '\n' ' ' |
  47. sed -e 's/^ *//' -e 's/ *$//'
  48. }