summaryrefslogtreecommitdiff
path: root/src/abslibre-tools/createworkdir
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2013-09-22 18:12:32 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2013-09-22 18:12:32 -0400
commit23d9c48a8d8a400450191b2604c9d9b29016af6a (patch)
treec5a5dd57d3b91f03f6c4c27c932c1f07b4d13b9c /src/abslibre-tools/createworkdir
parent70a82faa924bfc6f1462673aee11b1ff6093d82c (diff)
createworkdir: clean up
Use set -euE and trap for simpler error handling. Use libregit to fetch abslibre
Diffstat (limited to 'src/abslibre-tools/createworkdir')
-rwxr-xr-xsrc/abslibre-tools/createworkdir49
1 files changed, 18 insertions, 31 deletions
diff --git a/src/abslibre-tools/createworkdir b/src/abslibre-tools/createworkdir
index 59cb0f3..c7b2564 100755
--- a/src/abslibre-tools/createworkdir
+++ b/src/abslibre-tools/createworkdir
@@ -1,8 +1,10 @@
#!/bin/bash
+set -euE
# CreateWorkDir
# Creates a dir structure for working with Parabola packages
# Copyright 2010 Nicolás Reynolds
+# Copyright 2013 Luke Shumaker
# ---------- GNU General Public License 3 ----------
@@ -24,41 +26,26 @@
. libremessages
. $(librelib conf.sh)
load_files libretools
-check_vars libretools WORKDIR REPOS ABSLIBREGIT || exit 1
+check_vars libretools WORKDIR REPOS ABSLIBREGIT
-[[ ! -d ${WORKDIR} ]] && { # Create the WORKDIR
+trap 'error "Aborting..."' EXIT
- msg "Creating WORKDIR on %s" "${WORKDIR}"
- mkdir -p ${WORKDIR} ||{
- error "Could not create %s" "${WORKDIR}"; exit 1
- }
+msg "Creating WORKDIR at %s..." "$WORKDIR"
+mkdir -p "$WORKDIR"
-}
+msg "Creating staging directory in WORKDIR..."
+mkdir -p "$WORKDIR/staging"
-for _repo in "${REPOS[@]}"; do # Create the staging dirs
+cmd=(libregit "$ABSLIBREGIT" master "$WORKDIR/abslibre")
+if ! "${cmd[@]}"; then
+ error "Could not clone ABSLibre"
+ print "Try running this command:"
+ echo
+ print '%s' "${cmd[*]}"
+ exit 1
+fi
- [[ ! -d ${WORKDIR}/staging/${_repo} ]] && {
- mkdir -p ${WORKDIR}/staging/${_repo} || {
- error "Can't create %s" "${WORKDIR}/staging/${_repo}"
- exit 1
- }
- }
-
-done
-
-[[ ! -d ${WORKDIR}/abslibre/.git ]] && {
- msg "Cloning into ABSLibre"
- CMD="git clone ${ABSLIBREGIT} ${WORKDIR}/abslibre"
- ${CMD} || {
- error "Could not clone ABSLibre"
- plain "Try running this command:"
- echo
- plain "${CMD}"
- exit 1
- }
-}
-
-msg "Finished, your packaging dir tree looks like this now:"
+msg "Finished, your packaging directory tree looks like this now:"
ls --color=always ${WORKDIR}/*/*
-exit 0
+trap -- EXIT