diff -r 43ace4bb005e scripts/functions
--- a/scripts/functions	Wed Sep 26 16:37:31 2012 +0200
+++ b/scripts/functions	Fri Sep 28 18:15:49 2012 +0200
@@ -11,8 +11,8 @@
 
     # To avoid printing the backtace for each sub-shell
     # up to the top-level, just remember we've dumped it
-    if [ ! -f "${CT_BUILD_DIR}/backtrace" ]; then
-        touch "${CT_BUILD_DIR}/backtrace"
+    if [ ! -f "${CT_WORK_DIR}/backtrace" ]; then
+        touch "${CT_WORK_DIR}/backtrace"
 
         # Print steps backtrace
         step_depth=${CT_STEP_COUNT}
@@ -50,7 +50,7 @@
 
         CT_DoLog ERROR ""
         CT_DoEnd ERROR
-        rm -f "${CT_BUILD_DIR}/backtrace"
+        rm -f "${CT_WORK_DIR}/backtrace"
     fi
     exit $ret
 }
@@ -157,6 +157,7 @@
 # Usage: CT_DoExecLog <level> [VAR=val...] <command> [parameters...]
 CT_DoExecLog() {
     local level="$1"
+    local result
     shift
     (
     for i in "$@"; do
@@ -168,8 +169,41 @@
             *)      break;;
         esac
     done
-    CT_DoLog DEBUG "==> Executing: ${tmp_log}"
-    "${@}" 2>&1 |CT_DoLog "${level}"
+    trap ERR
+    while true; do
+        CT_DoLog DEBUG "==> Executing: ${tmp_log}"
+        "${@}" 2>&1 |CT_DoLog "${level}"
+        result=$?
+        if [ $result -eq 0 ]; then
+            break
+        fi
+        (
+            exec >&6
+            echo "command error $result:"
+            echo "$@"
+            echo "please fix it up and finish by exiting the shell"
+            while true; do
+                bash --rcfile <(echo "PS1='ct-ng:\w> '") -i
+                result=$?
+                case $result in
+                    1)  result=0; break;;
+                    2)  break;;
+                    3)  break;;
+                    *)  echo "please exit with one of these values:"
+                        echo "1  fixed, continue with next build command"
+                        echo "2  repeat this build command"
+                        echo "3  abort build"
+                        ;;
+                esac
+            done
+            exit $result
+        )
+        result=$?
+        if [ $result -ne 2 ]; then
+            break
+        fi
+    done
+    exit $result
     )
     # Catch failure of the sub-shell
     [ $? -eq 0 ]
