From 2c0580e98de6d37f94c9b0c119a9699003c35377 Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Fri, 03 Feb 2012 04:35:12 -0500 Subject: Optionally enter a debugging shell on error. --- 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' -- cgit v0.9.1