From 6afc694224777aede27f22334251385312c7edf1 Mon Sep 17 00:00:00 2001 From: Brielle Bruns Date: Mon, 14 May 2018 11:24:33 -0600 Subject: [PATCH] no message --- config | 5 ++++- meta-data | 2 +- virt-install-cloud.sh | 20 ++++++++++++++++---- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/config b/config index c95ecba..4fb2546 100644 --- a/config +++ b/config @@ -25,4 +25,7 @@ CONVERT=yes # Addresses to use by default for name servers nameserver1="8.8.8.8" -nameserver2="1.1.1.1" \ No newline at end of file +nameserver2="1.1.1.1" + +# Create ISO via method (genisoimage, xorriso, or cloud-localds) +iso_method="xorriso" \ No newline at end of file diff --git a/meta-data b/meta-data index 6b2c245..f28fdde 100644 --- a/meta-data +++ b/meta-data @@ -2,4 +2,4 @@ instance-id: iid-%GUEST_NAME%; hostname: %GUEST_NAME% local-hostname: %GUEST_NAME% manage_resolv_conf: true -dsmode: local +dsmode: local \ No newline at end of file diff --git a/virt-install-cloud.sh b/virt-install-cloud.sh index 19872ae..c1b9415 100755 --- a/virt-install-cloud.sh +++ b/virt-install-cloud.sh @@ -138,7 +138,9 @@ elif [[ $virt_netinfo_type == "1" ]]; then sed -e "s/%DOMAIN%/${domain}/" -e "s/%IP_ADDRESS%/${virt_netinfo_address}/" -e "s/%NETMASK%/${virt_netinfo_netmask}/" \ -e "s/%GATEWAY%/${virt_netinfo_gateway}/" -e "s/%NAMESERVER1%/${nameserver1}/" -e "s/%NAMESERVER2%/${nameserver2}/" \ ${WORKING_DIR}/network/network-config-v1 > ${WORKING_DIR}/output/network-config - extra_iso_files=" -map $WORKING_DIR/output/network-config network-config" + extra_iso_files_xorriso=" -map $WORKING_DIR/output/network-config network-config" + extra_iso_files_genisoimage="${WORKING_DIR}/output/network-config" + extra_iso_files_cloud-localds="-N ${WORKING_DIR}/output/network-config" fi elif [[ $virt_netinfo_type == "2" ]]; then echo "Not implemented yet!" @@ -163,8 +165,18 @@ fi # write the two cloud-init files into an ISO echo "Preparing ISO file required by cloud-init..." -#genisoimage -input-charset utf8 -output configuration.iso -volid cidata -joliet -rock user-data meta-data -xorriso -in_charset utf8 -outdev configuration.iso -volid cidata -joliet on -rockridge on -map output/user-data user-data -map output/meta-data meta-data ${extra_iso_files} + +case $iso_method in + genisoimage) + genisoimage -input-charset utf8 -output configuration.iso -volid cidata -joliet -rock ${WORKING_DIR}/output/user-data ${WORKING_DIR}/output/meta-data ${extra_iso_files_genisoimage} + ;; + xorriso) + xorriso -in_charset utf8 -outdev configuration.iso -volid cidata -joliet on -rockridge on -map output/user-data user-data -map output/meta-data meta-data ${extra_iso_files_xorriso} + ;; + cloud-localds) + cloud-localds ${WORKING_DIR}/configuration.iso ${WORKING_DIR}/output/user-data ${WORKING_DIR}/output/meta-data ${extra_iso_files_cloud-localds} + ;; +esac # keep a backup of the files for future reference if [[ "${BACKUP_ISO_FILES}" == "yes" ]]; then @@ -220,4 +232,4 @@ sleep 5 virsh change-media ${hostname}.${domain} vdb --eject --config # cleanup -rm configuration.iso output/meta-data output/user-data +rm configuration.iso output/meta-data output/user-data output/network-config