Skip to content

Commit

Permalink
Support adding more files besides user-data and meta-data to cloud-in…
Browse files Browse the repository at this point in the history
…it CIDATA ISO (#240)
  • Loading branch information
ferrarimarco authored Sep 20, 2021
1 parent c11fa5e commit 28d5199
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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 \
Expand Down

0 comments on commit 28d5199

Please sign in to comment.