Skip to content

Instantly share code, notes, and snippets.

@martin-langhoff
Created January 20, 2017 18:32
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save martin-langhoff/3fa550b835132c1edbf7be6617864f09 to your computer and use it in GitHub Desktop.
Save martin-langhoff/3fa550b835132c1edbf7be6617864f09 to your computer and use it in GitHub Desktop.
#!/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