[script] Allow scripts to be replaced

A script that downloads a new image using imgdownload() with the
action register_and_replace_image() can now be freed immediately
before the replacement image is executed.  This functionality is not
yet exposed via an iPXE command.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
pull/1/head
Michael Brown 2011-03-09 17:32:32 +00:00
parent 4562223420
commit e934447a60
1 changed files with 6 additions and 2 deletions

View File

@ -148,9 +148,13 @@ static int script_exec ( struct image *image ) {
rc = process_script ( image, script_exec_line,
terminate_on_exit_or_failure );
/* Restore saved state, re-register image, and return */
/* Restore saved state */
script_offset = saved_offset;
register_image ( image );
/* Re-register image (unless we have been replaced) */
if ( ! image->replacement )
register_image ( image );
return rc;
}