From 4651913e5507b113a078ccb2bdf2c4d6e044cda7 Mon Sep 17 00:00:00 2001 From: Derek Higgins Date: Thu, 1 Aug 2013 15:50:17 +0100 Subject: [PATCH] Add a new break on error A user running di-b several times while developing an element may not want to drop to a shell in all cases but may only want to do so if one of their in target hooks failed. This patch gives them the ability to do so, If break=after-error is set then a user will be provided a in target shell taking over from where the last failed command left off. Change-Id: Ia2f7ac4c21b64b971f87f4ae9cb867981b13eb5e --- README.md | 2 ++ bin/disk-image-create | 2 +- lib/img-functions | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 07e81006..3eb6850c 100644 --- a/README.md +++ b/README.md @@ -326,6 +326,8 @@ comma-delimited string. Some examples: * break=after-first-boot,before-pre-install will break after the first-boot hooks and before the pre-install hooks. +* break=after-error will break after an error during a in target hookpoint. + Images are built such that the Linux kernel is instructed not to switch into graphical consoles (i.e. it will not activate KMS). This maximises compatibility with remote console interception hardware, such as HP's iLO. diff --git a/bin/disk-image-create b/bin/disk-image-create index d36477ce..aadc7b6c 100755 --- a/bin/disk-image-create +++ b/bin/disk-image-create @@ -15,7 +15,7 @@ # License for the specific language governing permissions and limitations # under the License. -set -e +set -eE # Prevent perl from complaining a lot, but also remove any unexpected side-effects # of $LANG varying between build hosts diff --git a/lib/img-functions b/lib/img-functions index 58515100..40844d64 100644 --- a/lib/img-functions +++ b/lib/img-functions @@ -78,7 +78,9 @@ function run_d_in_target () { mkdir -p $DIB_CCACHE_DIR sudo mount --bind $DIB_CCACHE_DIR $TMP_MOUNT_PATH/tmp/ccache check_break before-$1 run_in_target bash + trap "check_break after-error run_in_target bash" ERR run_in_target dib-run-parts /tmp/in_target.d/$1.d + trap - ERR check_break after-$1 run_in_target bash sudo umount -f $TMP_MOUNT_PATH/tmp/in_target.d sudo rmdir $TMP_MOUNT_PATH/tmp/in_target.d