turnkeylinux / tracker

TurnKey Linux Tracker
https://www.turnkeylinux.org
71 stars 16 forks source link

bt-vm should use only open source tools to create OVA #622

Open JedMeister opened 8 years ago

JedMeister commented 8 years ago

Currently bt-vm (in buildtasks) relies on VMware's OVFTool. It works fine but it's not open source. It'd be better if the whole buildchain was open source. I think.

According to the OVF standard v1.1 here we need:

An OVF package shall consist of the following files: • one OVF descriptor with extension .ovf • zero or one OVF manifest with extension .mf • zero or one OVF certificate with extension .cert • zero or more disk image files • zero or more additional resource files, such as ISO images

So we only need something like this:

package.ovf
vmdisk1.vmdk

VirtualBox could be a candidate?

Create basic OVA in VBox:

APP=tkltester
VER=14.1
NAME=turnkey-$APP-$VER-jessie-amd64
vboxmanage createvm --name $NAME --register
vboxmanage modifyvm $NAME --description "big hoohar here..."
vboxmanage modifyvm $NAME --ostype Other_64 --memory 512 
vboxmanage modifyvm $NAME --vram 4 --pae on --boot1 disk --nic1 bridged
#vboxmanage createhd --filename $NAME.vmdk -size 10000 --variant Stream --format VMDK
vboxmanage storagectl $NAME --name "SCSI Controller" --add scsi 
vboxmanage storageattach $NAME --storagectl "SCSI Controller" \
    --port 0 --device 0 --type hdd --medium $NAME.vmdk
vboxmanage export $NAME -o  $NAME.ovf --product $APP \
    --producturl https://www.turnkeylinux.org/$APP \
    --vendor "TurnKey GNU/Linux" \
    --vendorurl https://www.turnkeylinux.org/ \
     --version $VER --options manifest,nomacs
sed -i "/VirtualSystemType/ s|virtualbox-2.2|vmx-07 &|" $NAME.ovf
SIZE=$(stat -c %s $NAME-disk*.vmdk)
sed -i "/File/ s|/| ovf:size=\"$SIZE\"/|" $NAME.ovf
SHA=$(openssl sha1 $NAME.ovf)
sed -i "s|.*$NAME.ovf.*|$SHA|" $NAME.mf

Works a treat in VirtualBox, but VMware complains that the OVF doesn't meet it's standards... :( We may have to tweak the OVF a bit before we get it right...

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

JedMeister commented 7 years ago

Not sure but perhaps https://github.com/glennmatthews/cot could be part of the solution? I.e. use that to tweak the OVF VBox spits out to make it VMware compatible? Obviously it all still needs to be tarred up, but that should be easy!

l-arnold commented 2 years ago

Is this helpful ? https://github.com/vmware/open-vm-tools#what-is-the-open-vm-tools-project

JedMeister commented 2 years ago

Thanks @l-arnold, unfortunately not. We already install open-vm-tools from Debian repos (but only in the VM builds).

VMware's OVFTool is a (free as in beer) proprietary tool to create the actual OVA files.

l-arnold commented 2 years ago

I will look again at the process to install OVFTool. I have done a few times before but my hopes were raised for not having to somehow.