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
This commit is contained in:
Derek Higgins 2013-08-01 15:50:17 +01:00
parent 4284936084
commit 4651913e55
3 changed files with 5 additions and 1 deletions

View file

@ -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.

View file

@ -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

View file

@ -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