123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- #!/bin/bash
- #shellcheck disable=SC1090
-
- . "$(sfpath)" || exit 3
-
- shellfu import pretty
-
- shellfu import sutagent
-
- usage() {
- mkusage "" "--help" \
- -- \
- "This is a special-purpose tool to regenerate BeakerLib version of" \
- "SUT installation agent used with 'morf install'." \
- "" \
- "In order to create a Beaker task to use SUT agent, call this tool" \
- "without any arguments and save the contents as an executable along"\
- "the task. In runtest.sh, start a phase and call the executable as"\
- "described in documentation of sutagent__install() function (access"\
- "that by calling 'sfdoc sutagent')." \
- "" \
- "One such task is /distribution/upgrade/install-sut."
- }
-
- mkagent() {
- #
- # Create agent script
- #
- mkfunc
- echo '. /usr/bin/rhts-environment.sh || exit 1'
- echo '. /usr/share/beakerlib/beakerlib.sh || exit 1'
- echo 'sutagent__install "$@"'
- }
-
- mkfunc() {
- #
- # Create agent script declarations
- #
- local raw
- raw=$(mktemp -t bkr_sutagent.XXXXXXXX)
- #shellcheck disable=SC2016
- {
- echo '#!/bin/bash'
- echo ''
- echo '. "$(sfpath)" || exit 3'
- echo ''
- echo 'PRETTY=beakerlib'
- echo 'PRETTY_VERBOSE=true'
- echo 'PRETTY_DEBUG=true'
- echo ''
- echo 'shellfu import sutagent'
- } > "$raw"
- chmod +x "$raw"
- sfembed "$raw"
- rm "$raw"
- }
-
- main() {
- while true; do case $1 in
- "") break ;;
- -*) usage ;;
- esac done
- mkagent
- }
-
- main "$@"
|