summaryrefslogtreecommitdiffstats
path: root/src/image
diff options
context:
space:
mode:
authorMichael Brown2011-03-09 18:32:32 +0100
committerMichael Brown2011-03-09 18:32:32 +0100
commite934447a60e7d9fe84e246ad03c1a16d4bb88a9b (patch)
treeda68444ba14359b96e266a6d5d04f6ba85fa528a /src/image
parent[image] Avoid ending up with multiple selected images on re-registration (diff)
downloadipxe-e934447a60e7d9fe84e246ad03c1a16d4bb88a9b.tar.gz
ipxe-e934447a60e7d9fe84e246ad03c1a16d4bb88a9b.tar.xz
ipxe-e934447a60e7d9fe84e246ad03c1a16d4bb88a9b.zip
[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 9749b097..161ac682 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;
}