VOL-4925 - Build and release components.

jjb/shell/github-release.sh
---------------------------
  o Added a display banner to identify running script and version.
    Recent change to use cp -vs- rsync for release/* copy is not
    visible in the job log -- timing issue ?
  o Source common lib stacktrace.sh and traputils.sh to be more
    verbose when the script edits (courtesy of set -e).
  o Debugging statements added.
  o Use stacktrace.sh to display callstack when script exits with error.

jjb/shell/common/README.md
jjb/shell/common/common.sh
jjb/shell/common/example.sh
jjb/shell/common/preserve_argv.sh
jjb/shell/common/common/sh/tempdir.sh
jjb/shell/common/common/sh/traputils.sh
jjb/shell/common/common/sh/stacktrace.sh
-----------------------------------------
  o Create a common library of reusable utility shell scripts.
  o tempdir.sh    - automatic creation and removal of mktempdir()
  o stacktrace.sh - display script call stack.
  o traputils.sh  - register an interrupt handler calling stacktrace on exit.

Change-Id: I563948f078cf33fef4a58be2b7455f07a3bd9e3a
diff --git a/jjb/shell/common/common.sh b/jjb/shell/common/common.sh
new file mode 100644
index 0000000..268c701
--- /dev/null
+++ b/jjb/shell/common/common.sh
@@ -0,0 +1,69 @@
+# -*- sh -*-
+## -----------------------------------------------------------------------
+## Intent:
+##   o This script can be used as a one-liner for sourcing common scripts.
+##   o Preserve command line arguments passed.
+##   o Accept common.sh arguments specifying a set of libraries to load.
+##   o Dependent common libraries will automatically be sourced.
+## -----------------------------------------------------------------------
+## Usage:
+##   o source common.sh --common-args-begin-- --tempdir
+##   o source common.sh --common-args-begin-- --stacktrace
+## -----------------------------------------------------------------------
+
+# __DEBUG_COMMON__=1
+[[ -v __DEBUG_COMMON__ ]] && echo " ** ${BASH_SOURCE[0]}: BEGIN"
+
+## -----------------------------------------------------------------------
+## Intent: Anonymous function used to source common shell libs
+## -----------------------------------------------------------------------
+## Usage: source common.sh '--stacktrace'
+## -----------------------------------------------------------------------
+function __anon_func__()
+{
+    local iam="${BASH_SOURCE[0]%/*}"
+    local cab='--common-args-begin--'
+
+    declare -a args=($*)
+
+    local raw
+    raw="$(readlink --canonicalize-existing --no-newline "${BASH_SOURCE[0]}")"
+    local top="${raw%/*}"
+    local common="${top}/common/sh"
+
+    local arg
+    for arg in "${args[@]}";
+    do
+	    case "$arg" in
+	        --tempdir)    source "${common}"/tempdir.sh    ;;
+	        --traputils)  source "${common}"/traputils.sh  ;;
+	        --stacktrace) source "${common}"/stacktrace.sh ;;
+            *) echo "ERROR ${BASH_SOURCE[0]}: [SKIP] unknown switch=$arg" ;;
+	    esac
+    done
+
+    return
+}
+
+##----------------##
+##---]  MAIN  [---##
+##----------------##
+source "${BASH_SOURCE[0]%/*}/preserve_argv.sh" # pushd @ARGV
+
+if [ $# -gt 0 ] && [ "$1" == '--common-args-begin--' ]; then
+    shift # remove arg marker
+fi
+
+if [ $# -eq 0 ]; then
+    # common.sh defaults
+    set -- '--tempdir' '--traputils' '--stacktrace'
+fi
+
+__anon_func__ "$@"
+unset __anon_func__
+source "${BASH_SOURCE[0]%/*}/preserve_argv.sh" # popd @ARGV
+
+[[ -v __DEBUG_COMMON__ ]] && echo " ** ${BASH_SOURCE[0]}: END"
+: # NOP
+
+# [EOF]