diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2017-05-01 17:46:32 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2017-05-04 14:28:08 -0400 |
commit | 2ae5371f347603d34a7ccc33681e612db338d11e (patch) | |
tree | 2ecb5b05dcb1ffc2defb31c7f64d6720435f13e5 /src/abslibre-tools/createworkdir | |
parent | bb97cfc85d9b711b517985abbd9832bff9c4b37a (diff) |
Have everything use a main() function, where it isn't too tricky to convert
"Ignore space change" is essential to making sense of this patch.
Diffstat (limited to 'src/abslibre-tools/createworkdir')
-rwxr-xr-x | src/abslibre-tools/createworkdir | 43 |
1 files changed, 24 insertions, 19 deletions
diff --git a/src/abslibre-tools/createworkdir b/src/abslibre-tools/createworkdir index 80b2d5e..e3e4143 100755 --- a/src/abslibre-tools/createworkdir +++ b/src/abslibre-tools/createworkdir @@ -27,28 +27,33 @@ set -euE . "$(librelib messages)" . "$(librelib conf)" -load_files libretools -check_vars libretools WORKDIR ABSLIBRERECV ABSLIBRESEND # these are asked for by `xbs download` -trap 'error "Aborting..."' EXIT +main() { + load_files libretools + check_vars libretools WORKDIR ABSLIBRERECV ABSLIBRESEND # these are asked for by `xbs download` -msg "Creating WORKDIR at %s..." "$WORKDIR" -mkdir -p "$WORKDIR" + trap 'error "Aborting..."' EXIT -msg "Creating staging directory in WORKDIR..." -mkdir -p "$WORKDIR/staging" + msg "Creating WORKDIR at %s..." "$WORKDIR" + mkdir -p "$WORKDIR" -cmd=(xbs -b abslibre download) -if ! "${cmd[@]}"; then - error "Could not clone ABSLibre" - plain "Try running this command:" - echo - printf '%q ' "${cmd[@]}" - echo - exit 1 -fi + msg "Creating staging directory in WORKDIR..." + mkdir -p "$WORKDIR/staging" -msg "Finished, your packaging directory tree looks like this now:" -ls --color=auto "${WORKDIR}"/* + cmd=(xbs -b abslibre download) + if ! "${cmd[@]}"; then + error "Could not clone ABSLibre" + plain "Try running this command:" + echo + printf '%q ' "${cmd[@]}" + echo + exit 1 + fi -trap -- EXIT + msg "Finished, your packaging directory tree looks like this now:" + ls --color=auto "${WORKDIR}"/* + + trap -- EXIT +} + +main "$@" |