just a dummy repo for a dummy package

bkr_sutagent 1.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #!/bin/bash
  2. #shellcheck disable=SC1090
  3. . "$(sfpath)" || exit 3
  4. shellfu import pretty
  5. shellfu import sutagent
  6. usage() {
  7. mkusage "" "--help" \
  8. -- \
  9. "This is a special-purpose tool to regenerate BeakerLib version of" \
  10. "SUT installation agent used with 'morf install'." \
  11. "" \
  12. "In order to create a Beaker task to use SUT agent, call this tool" \
  13. "without any arguments and save the contents as an executable along"\
  14. "the task. In runtest.sh, start a phase and call the executable as"\
  15. "described in documentation of sutagent__install() function (access"\
  16. "that by calling 'sfdoc sutagent')." \
  17. "" \
  18. "One such task is /distribution/upgrade/install-sut."
  19. }
  20. mkagent() {
  21. #
  22. # Create agent script
  23. #
  24. mkfunc
  25. echo '. /usr/bin/rhts-environment.sh || exit 1'
  26. echo '. /usr/share/beakerlib/beakerlib.sh || exit 1'
  27. echo 'sutagent__install "$@"'
  28. }
  29. mkfunc() {
  30. #
  31. # Create agent script declarations
  32. #
  33. local raw
  34. raw=$(mktemp -t bkr_sutagent.XXXXXXXX)
  35. #shellcheck disable=SC2016
  36. {
  37. echo '#!/bin/bash'
  38. echo ''
  39. echo '. "$(sfpath)" || exit 3'
  40. echo ''
  41. echo 'PRETTY=beakerlib'
  42. echo 'PRETTY_VERBOSE=true'
  43. echo 'PRETTY_DEBUG=true'
  44. echo ''
  45. echo 'shellfu import sutagent'
  46. } > "$raw"
  47. chmod +x "$raw"
  48. sfembed "$raw"
  49. rm "$raw"
  50. }
  51. main() {
  52. while true; do case $1 in
  53. "") break ;;
  54. -*) usage ;;
  55. esac done
  56. mkagent
  57. }
  58. main "$@"