summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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