Convert OVFs to an OVA without the ovftool.exe

VMware requires you to have an account to logon and download a free tool called "VMware OVF Tool".  That alone is not annoying.  What is annoying is that the tool is extremely slow.  There is a much faster way to create an OVA without the need of this tool.

Using the ovftool is easy enough, the following is an example syntax.

ovftool.exe c:\ovf-to-ova-test\my.ovf c:\ovf-to-ova-test\my.ova

Basically this tool, opens the ovf, validates it against an SHA1 manifest and begins to write the tool.

This can be accomplished using tar.  One could achieve the same result using tar in Windows using CygWin or Linux.  While I successfully created an OVA in CygWin the ownership reflected my username and group, I wanted to match the VMware ownership and group of "someone".

It is also important to note that the order of the files are important.  The file must be created with the ????.ovf file first followed by the .mf file and then the .vmdk files.

Here is how it can be done in Linux.  The assumption here is that all the files that are needed are in its own directory.

#!/bin/bash

# Create a user someone if not exists
id -u someone &>/dev/null || useradd someone

sha1sum --status -c *.mf
if [ "$?" = "0" ] ; then
  tar cvf myova.ova *.ovf --owner=someone --group=someone
  tar uvf myova.ova *.mf *.vmdk --owner=someone --group=someone
else
  echo "bad checksum"
fi

Source(s)

  • https://unix.stackexchange.com/questions/28526/add-a-user-to-the-system-only-if-it-doesnt-exist
  • https://askubuntu.com/questions/61826/how-do-i-check-the-sha1-hash-of-a-file
  • https://www.linuxquestions.org/questions/programming-9/script-to-check-if-two-variables-match-always-says-they-match-even-if-they-don%27t-bash-4175543893/
  • https://unix.stackexchange.com/questions/125419/modify-file-ownership-for-files-inside-tar-archive