X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fbtr;a=blobdiff_plain;f=share%2Fbtr%2Fbtrc.sh;h=8a38bb348ca4234211dda826ad600041defc0849;hp=beff3b4992b26a6b531d4981c643cc4c5432d1ae;hb=ef064f115b81c2aeef7b0edc9e5f1d8b9d12604a;hpb=dbcbb3c734fe1ba928dc9c4819d4997eab1a8300 diff --git a/share/btr/btrc.sh b/share/btr/btrc.sh old mode 100644 new mode 100755 index beff3b4..8a38bb3 --- a/share/btr/btrc.sh +++ b/share/btr/btrc.sh @@ -1,34 +1,7 @@ #!/bin/bash -function btrc-help { - btr-banner - echo - echo "Usage: $(basename $0) [-hyvq] [] [action] " - echo - echo " -h, --help Display this help" - echo " -y, --yes Always assume yes" - echo " -v, --verbose Be more verbose" - echo " -q, --quiet Be more quiet" - echo - echo " Options:" - echo " -D, --directory=" - echo " Use this directory as work root" - echo - echo " Actions:" - echo " s[tatus] Show the status of the build" - echo " r[un] Make a BTR run" - echo " c[ancel] Cancel any currently running BTR job" - echo " t[erminate] Terminate the BTR daemon" - echo - echo " Arguments:" - echo " The build id of the \`btrd\` daemon, usually" - echo " something like \$repository@\$branch[-\$suffix]." - echo - exit -} -export -f btrc-help - function btrc-parseargs { + eval set -- "$BTR_EXTRA_ARGS" while test $# -gt 0 do case "$1" in @@ -57,57 +30,13 @@ function btrc-parseargs { done } -function btrc-parseopts { - local shortoptions="hvqyD:" - local longoptions="help,verbose,quiet,yes,directory:" - local options=$(getopt \ - --options "$shortoptions" \ - --longoptions "$longoptions" \ - -- "$@" \ - ) - - if test $? -ne 0 ; then - btrc-help - fi - - eval set -- "$options" - - while test $# -gt 1 - do - case "$1" in - -h|--help) - btrc-help - ;; - -y|--yes) - BTR_FORCEYES=true - ;; - -v|--verbose) - BTR_VERBOSE=true - BTR_QUIET=false - ;; - -q|--quiet) - BTR_QUIET=true - BTR_VERBOSE=false - ;; - # - -D|--directory) - BTR_RUNDIR="$2" - shift - ;; - # - --) - shift - btrc-parseargs "$@" - esac - shift - done -} -export -f btrc-parseopts - function btrc-setup { + btrc-parseargs + if test -z "$BTR_BUILD" then - btrc-help + btr-banner + btr-help fi if test -z "$BTR_ACTION" @@ -116,7 +45,7 @@ function btrc-setup { fi btr-setup-rundir - btr-setup-verbosity + btr-setup-verbosity false BTR_PIDFILE="$BTR_RUNDIR/$BTR_BUILD.pid" BTR_LOGFILE="$BTR_RUNDIR/$BTR_BUILD.log" @@ -131,7 +60,7 @@ function btrc-setup { cat "$BTR_LOGFILE" echo fi - error "Could not find pid file of btr daemon for '$BTR_BUILD' in $BTR_RUNDIR." + error "Could not find btrd pid file of '$BTR_BUILD' in $BTR_RUNDIR." fi } export -f btrc-setup