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/example.sh b/jjb/shell/common/example.sh
new file mode 100755
index 0000000..0c0e46a
--- /dev/null
+++ b/jjb/shell/common/example.sh
@@ -0,0 +1,66 @@
+#!/bin/bash
+## -----------------------------------------------------------------------
+## Intent: An example script showing how to source common libraries
+##    and produce a stack trace on script error/exit
+## -----------------------------------------------------------------------
+
+declare -g fatal=1 # assign to view stack trace
+
+echo "$0: ENTER"
+
+echo "$0: Source library shell includes"
+
+declare -g pgmdir="${0%/*}" # dirname($script)
+declare -a common_args=()
+common_args+=('--common-args-begin--')
+# common_args+=('--traputils')
+# common_args+=('--stacktrace')
+# common_args+=('--tempdir')
+source "${pgmdir}/common.sh" "${common_args[@]}"
+
+echo "$0: define foo(), bar() & tans()"
+
+function foo()
+{
+    echo "${FUNCNAME}: hello - stack_frame[1]"
+    bar
+}
+
+function bar()
+{
+    echo "${FUNCNAME}: hello - stack_frame[2]"
+    tans
+}
+
+function tans()
+{
+    declare -g fatal
+    echo "${FUNCNAME}: early exit for stacktrace"
+    [[ $fatal -eq 1 ]] && exit 1
+    return
+}
+
+echo "$0: calling foo() for a stack trace"
+foo
+
+echo "$0: ENTER"
+
+## -----------------------------------------------------------------------
+# % ./example.sh
+# ./example.sh: ENTER
+# ./example.sh: Source library shell includes
+# ./example.sh: define foo(), bar() & tans()
+# ./example.sh: calling foo() for a stack trace
+# foo: hello - stack_frame[1]
+# bar: hello - stack_frame[2]
+# tans: early exit for stacktrace
+# 
+# OFFENDER: ./example.sh:1
+# ERROR: 'exit 1' exited with status 1
+# Call tree:
+# 1: ./example.sh:25 tans(...)
+# 2: ./example.sh:19 bar(...)
+# 3: ./example.sh:37 foo(...)
+# Exiting with status 1
+
+# [EOF]