I have the following packages installed:
- VirtualBox-OSE
- rubygem-boxgrinder-build
Starting from a boxgrinder appliance definition file...
http://boxgrinder.org/tutorials/appliance-definition/
...the script creates an .ova image that can be easily imported and used by 3rd parties like this:
$ VBoxManage import f16-xfce.ova $ VirtualBox --startvm f16-xfce
And now for the script:
#!/bin/sh NAME=f16-xfce OS=Fedora_64 IMAGE=/tmp/${NAME}.vmdk SZMB=1536 INSTDIR=/tmp/boxes/ BUILDDIR=/tmp/builds/ mkdir -p ${BUILDDIR} cat > ${BUILDDIR}/${NAME}.appl << EOF name: f16-xfce summary: Fedora with xfce os: name: fedora version: 16 hardware: partitions: "/": size: 5 packages: - @base - @base-x - @fonts - @xfce-desktop - @critical-path-xfce post: base: - "useradd boxgrinder && echo boxgrinder | passwd boxgrinder --stdin" - "ln -s --force /lib/systemd/system/graphical.target /etc/systemd/system/default.target" EOF cd ${BUILDDIR} sudo -E boxgrinder-build -p virtualbox ${NAME}.appl cp ${BUILDDIR}/build/appliances/x86_64/fedora/16/${NAME}/1.0/virtualbox-plugin/${NAME}.vmdk ${IMAGE} VBoxManage createvm --name ${NAME} --ostype ${OS} --register --basefolder ${INSTDIR} VBoxManage modifyvm ${NAME} --memory ${SZMB} --vram 32 VBoxManage storagectl ${NAME} --name "SATA Controller" --add sata --controller IntelAHCI VBoxManage storageattach ${NAME} --storagectl "SATA Controller" --type hdd --port 0 --device 0 --medium ${IMAGE} VBoxManage export ${NAME} --manifest -o ${BUILDDIR}/${NAME}.ova # VirtualBox --startvm ${NAME}
1 comment:
Very nice Jason, thanks for the tip!
Post a Comment