From 28d5199a51885d43bc40103b3a3d28f575add618 Mon Sep 17 00:00:00 2001 From: Marco Ferrari Date: Mon, 20 Sep 2021 14:14:13 +0200 Subject: [PATCH] Support adding more files besides user-data and meta-data to cloud-init CIDATA ISO (#240) --- .../scripts/generate-cloud-init-cidata-iso.sh | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/provisioning/os-images/docker/scripts/generate-cloud-init-cidata-iso.sh b/provisioning/os-images/docker/scripts/generate-cloud-init-cidata-iso.sh index a8086738c..4812a30c6 100755 --- a/provisioning/os-images/docker/scripts/generate-cloud-init-cidata-iso.sh +++ b/provisioning/os-images/docker/scripts/generate-cloud-init-cidata-iso.sh @@ -117,6 +117,11 @@ cloud-init devel schema --config-file "${CLOUD_INIT_DATASOURCE_SOURCE_DIRECTORY_ TEMP_CLOUD_INIT_WORKING_DIRECTORY="$(mktemp -d)" +CLOUD_INIT_DATASOURCE_ISO_PATH="${CLOUD_INIT_DATASOURCE_OUTPUT_DIRECTORY_PATH}"/cloud-init-datasource.iso + +echo "Removing the eventual leftovers from previous runs..." +rm -f "${CLOUD_INIT_DATASOURCE_ISO_PATH}" + echo "Copying cloud-init configuration files to ${TEMP_CLOUD_INIT_WORKING_DIRECTORY}..." cp \ --force \ @@ -128,8 +133,16 @@ echo "Removing the yaml file extension from cloud init datasource configuration mv --verbose "${TEMP_CLOUD_INIT_WORKING_DIRECTORY}"/meta-data.yaml "${TEMP_CLOUD_INIT_WORKING_DIRECTORY}"/meta-data mv --verbose "${TEMP_CLOUD_INIT_WORKING_DIRECTORY}"/user-data.yaml "${TEMP_CLOUD_INIT_WORKING_DIRECTORY}"/user-data +# We don't use cloud-localds here because it doesn't support adding data to the +# ISO, besides user-data, network-config, vendor-data echo "Generating the CIDATA ISO..." -cloud-localds "${CLOUD_INIT_DATASOURCE_OUTPUT_DIRECTORY_PATH}"/cloud-init-datasource.iso "${TEMP_CLOUD_INIT_WORKING_DIRECTORY}"/user-data "${TEMP_CLOUD_INIT_WORKING_DIRECTORY}"/meta-data +genisoimage \ + -joliet \ + -output "${CLOUD_INIT_DATASOURCE_ISO_PATH}" \ + -rock \ + -verbose \ + -volid cidata \ + "${TEMP_CLOUD_INIT_WORKING_DIRECTORY}" echo "Deleting the temporary working directory (${TEMP_CLOUD_INIT_WORKING_DIRECTORY})..." rm \