瀏覽代碼

[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 年之前
父節點
當前提交
e934447a60
共有 1 個文件被更改,包括 6 次插入2 次删除
  1. 6
    2
      src/image/script.c

+ 6
- 2
src/image/script.c 查看文件

@@ -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…
取消
儲存