@@ -434,6 +434,18 @@ def start_cuttlefish_device(use_kernel=False):
434434 on_cuttlefish_host = True )
435435
436436
437+ def copy_images_to_cuttlefish ():
438+ """Copy and Combine cvd host package and OTA images."""
439+ image_directory = environment .get_value ('IMAGES_DIR' )
440+ cvd_dir = environment .get_value ('CVD_DIR' )
441+ for image_filename in os .listdir (image_directory ):
442+ if image_filename .endswith ('.zip' ) or image_filename .endswith ('.tar.gz' ):
443+ continue
444+ image_src = os .path .join (image_directory , image_filename )
445+ image_dest = os .path .join (cvd_dir , image_filename )
446+ copy_to_cuttlefish (image_src , image_dest )
447+
448+
437449def stop_cuttlefish_device ():
438450 """Stops the cuttlefish device."""
439451 cvd_dir = environment .get_value ('CVD_DIR' )
@@ -461,21 +473,14 @@ def recreate_cuttlefish_device():
461473 cvd_dir = environment .get_value ('CVD_DIR' )
462474 logs .log ('cvd_dir: %s' % str (cvd_dir ))
463475
476+ copy_images_to_cuttlefish ()
464477 stop_cuttlefish_device ()
465478
466479 # Delete all existing images.
467480 rm_cmd = f'rm -rf { cvd_dir } /*'
468481 execute_command (rm_cmd , timeout = RECOVERY_CMD_TIMEOUT , on_cuttlefish_host = True )
469482
470- # Copy and Combine cvd host package and OTA images.
471- image_directory = environment .get_value ('IMAGES_DIR' )
472- for image_filename in os .listdir (image_directory ):
473- if image_filename .endswith ('.zip' ) or image_filename .endswith ('.tar.gz' ):
474- continue
475- image_src = os .path .join (image_directory , image_filename )
476- image_dest = os .path .join (cvd_dir , image_filename )
477- copy_to_cuttlefish (image_src , image_dest )
478-
483+ copy_images_to_cuttlefish ()
479484 start_cuttlefish_device ()
480485
481486
0 commit comments