mod_image_for_recovery.sh: Recovery preserve factory installed DLCs

During recovery image process, factory installed DLCs must be installed
into the recovery image stateful.

Also rename due to COIL.

BUG=b:202218076
TEST=./mod_image_for_recovery.sh --board=$BOARD --nominimize_image
--image chromiumos_test_image.bin --to recovery_test_image.bin

Change-Id: I0dc35caf37eb3651486ede86b3206b03775e5007
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosutils/+/3232844
Commit-Queue: Jae Hoon Kim <kimjae@chromium.org>
Tested-by: Jae Hoon Kim <kimjae@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
diff --git a/mod_image_for_recovery.sh b/mod_image_for_recovery.sh
index 75b6586..ca076c3 100755
--- a/mod_image_for_recovery.sh
+++ b/mod_image_for_recovery.sh
@@ -76,7 +76,11 @@
 
 # Files to preserve from original stateful, if minimize_image is true.
 # If minimize_image is false, everything is always preserved.
-WHITELIST="vmlinuz_hd.vblock unencrypted/import_extensions"
+ALLOWLIST=(
+  "vmlinuz_hd.vblock"
+  "unencrypted/import_extensions"
+  "unencrypted/dlc-factory-images"
+)
 
 get_install_vblock() {
   # If it exists, we need to copy the vblock over to stateful
@@ -324,7 +328,7 @@
   sudo mkdir --mode=755 "${new_stateful_mnt}/unencrypted"
 
   # Copy over any files that need to be preserved.
-  for name in ${WHITELIST}; do
+  for name in "${ALLOWLIST[@]}"; do
     if [ -e "${old_stateful_mnt}/${name}" ]; then
       sudo cp -a "${old_stateful_mnt}/${name}" "${new_stateful_mnt}/${name}"
     fi
@@ -367,7 +371,7 @@
   sudo mount "${IMAGE_DEV}p${partition_num_state}" "${old_stateful_mnt}"
 
   # Print the minimum number of sectors needed.
-  find_sectors_needed "${old_stateful_mnt}" "${WHITELIST}"
+  find_sectors_needed "${old_stateful_mnt}" "${ALLOWLIST[*]}"
 
   # Cleanup everything.
   safe_umount "${old_stateful_mnt}"