summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2013-06-02 21:45:16 -0600
committerLuke Shumaker <LukeShu@sbcglobal.net>2013-06-02 21:45:16 -0600
commit882c842e9feb38b0be3e952e397b3e598053d4ac (patch)
tree3ea22eb445f3a18f9cda91a4b2179184514e4bf7
parent80c990cf48f2c17cb30a77f39ebce18273ed64b0 (diff)
various fixes with pbs-convert-absgit
- libremessages defines a cleanup(); define ours after loading it - don't create TMPDIR or set traps until main() - parse -h flag - print usage to stderr instead of stdout for incorrect number of args
-rwxr-xr-xpbs-convert-absgit12
1 files changed, 7 insertions, 5 deletions
diff --git a/pbs-convert-absgit b/pbs-convert-absgit
index 22539d3..9e82330 100755
--- a/pbs-convert-absgit
+++ b/pbs-convert-absgit
@@ -1,14 +1,12 @@
#!/bin/bash -euE
+. libremessages
+
cmd="${0##*/}"
-export TMPDIR="`mktemp -d --tmpdir ${cmd}.XXXXXXXXXX`"
cleanup() {
msg "$(gettext "Removing temporary files...")"
echo rm -rf "$TMPDIR"
}
-trap cleanup EXIT
-
-. libremessages
abort() {
echo # force a fresh line
@@ -192,8 +190,12 @@ usage() {
}
main() {
+ in_array '-h' "$@" && { usage; return 0; }
+ [[ $# = 1 ]] || { usage >&2; return 1; }
+
+ export TMPDIR="`mktemp -d --tmpdir ${cmd}.XXXXXXXXXX`"
trap abort EXIT
- [[ $# = 1 ]] || { usage; return 1; }
+
local source=$1
local cache="$(pbs-plumb-config get core.cachedir)/${source}.git"