Created
January 20, 2017 18:32
-
-
Save martin-langhoff/3fa550b835132c1edbf7be6617864f09 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
id_in_output(){ | |
id="$(grep -Po '(?:UUID: ).+' "$1")" | |
if [ -z "$id" ]; then | |
echo 'Cannot find id' | |
exit 1 | |
fi | |
echo "${id:6}" | |
} | |
configname=$1 | |
tmpout="$(mktemp /tmp/imagefactory.out.XXXXXXXXXX)" | |
imagefactory base_image \ | |
--file-parameter install_script "${configname}.ks" \ | |
--parameter offline_icicle true \ | |
"${configname}.tdl" \ | |
| tee "$tmpout" | |
imgid="$(id_in_output $tmpout)" | |
imagefactory target_image \ | |
--parameter vsphere_vmdk_format standard \ | |
--id "${imgid}" vsphere \ | |
| tee "$tmpout" | |
imgid="$(id_in_output $tmpout)" | |
imagefactory target_image \ | |
--id $imgid \ | |
--parameter ovf_cpu_count 4 \ | |
--parameter ovf_memory_mb 4096 \ | |
--parameter ovf_name XYZ \ | |
ova |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment