Browse Source

[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>
tags/v1.20.1
Michael Brown 13 years ago
parent
commit
e934447a60
1 changed files with 6 additions and 2 deletions
  1. 6
    2
      src/image/script.c

+ 6
- 2
src/image/script.c View File

@@ -148,9 +148,13 @@ static int script_exec ( struct image *image ) {
148 148
 	rc = process_script ( image, script_exec_line,
149 149
 			      terminate_on_exit_or_failure );
150 150
 
151
-	/* Restore saved state, re-register image, and return */
151
+	/* Restore saved state */
152 152
 	script_offset = saved_offset;
153
-	register_image ( image );
153
+
154
+	/* Re-register image (unless we have been replaced) */
155
+	if ( ! image->replacement )
156
+		register_image ( image );
157
+
154 158
 	return rc;
155 159
 }
156 160
 

Loading…
Cancel
Save