aboutsummaryrefslogtreecommitdiff
path: root/src/image
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2011-03-09 17:32:32 +0000
committerMichael Brown <mcb30@ipxe.org>2011-03-09 17:32:32 +0000
commite934447a60e7d9fe84e246ad03c1a16d4bb88a9b (patch)
treeda68444ba14359b96e266a6d5d04f6ba85fa528a /src/image
parent4562223420c983864b2335b0a9bfe8d70993e123 (diff)
downloadipxe-e934447a60e7d9fe84e246ad03c1a16d4bb88a9b.zip
ipxe-e934447a60e7d9fe84e246ad03c1a16d4bb88a9b.tar.gz
ipxe-e934447a60e7d9fe84e246ad03c1a16d4bb88a9b.tar.bz2
[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>
Diffstat (limited to 'src/image')
-rw-r--r--src/image/script.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/image/script.c b/src/image/script.c
index 9749b09..161ac68 100644
--- a/src/image/script.c
+++ b/src/image/script.c
@@ -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;
}