diff options
author | P. J. McDermott <pjm@nac.net> | 2012-02-03 04:35:12 (EST) |
---|---|---|
committer | P. J. McDermott <pjm@nac.net> | 2012-02-03 04:35:12 (EST) |
commit | 2c0580e98de6d37f94c9b0c119a9699003c35377 (patch) | |
tree | 6adebbe2750c8b8a71dc1fa89b09cabb040d4b93 | |
parent | 0564fc20ebeae8510b30ef6b338933535fdac0ef (diff) |
Optionally enter a debugging shell on error.
-rw-r--r-- | src/opkbuild | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/opkbuild b/src/opkbuild index d920da9..b3a5f84 100644 --- a/src/opkbuild +++ b/src/opkbuild @@ -31,12 +31,16 @@ print_usage() error() { printf 'opkbuild: [%s] Error\n' "${1}" + if ${dbg}; then + printf 'opkbuild: Starting debugging shell...' >&2 + /bin/sh + fi cd .. rm -Rf tmp 2> /dev/null exit 1 } -opts=$(getopt -n "${0}" -o 'r:p:' -- "${@}") +opts=$(getopt -n "${0}" -o 'r:p:d' -- "${@}") if [ ${?} -ne 0 ]; then print_usage "${0}" >&2 exit 1; @@ -52,6 +56,10 @@ while true; do platform=${2} shift 2 ;; + -d) + dbg=true + shift + ;; --) shift break @@ -71,6 +79,9 @@ if [ ${?} -ne 0 ]; then printf 'opkbuild: Error running command to gain UID 0\n' >&2 exit 1 fi +if [ -z "${dbg}" ]; then + dbg=false +fi # Sanity checks. printf 'opkbuild: Checking for sanity...\n' |