diff options
Diffstat (limited to 'x86_64-generic/create-vm')
-rwxr-xr-x | x86_64-generic/create-vm | 110 |
1 files changed, 0 insertions, 110 deletions
diff --git a/x86_64-generic/create-vm b/x86_64-generic/create-vm deleted file mode 100755 index 84137e4..0000000 --- a/x86_64-generic/create-vm +++ /dev/null @@ -1,110 +0,0 @@ -#!/bin/sh -set -e - -DEVEL_IMAGE_NAME="water-bomb-devel-x86_64" - -# Usage: baserock-install-vm $VM_NAME $INSTALL_DIRECTORY -VM_NAME="$1" -INSTALL_DIRECTORY="$2" - -VM_VBOX_NAME=$(echo "$VM_NAME" | sed 's|\s|\.|g') - -if [ -z "$VM_NAME" ]; then - echo "A name must be specified for this virtual machine" - echo "Usage: $0 VM_NAME INSTALL_DIRECTORY" - exit 1 -fi - -if [ -z "$INSTALL_DIRECTORY" ]; then - echo "An install directory must be specified for this virtual machine" - echo "Usage: $0 VM_NAME INSTALL_DIRECTORY" - exit 1 -fi - -# Check that we don't already have a VM of this name -if [ -e "$VM_NAME.vdi" ]; then - echo "A VM by this name already exists" - exit 1 -fi - -# Ensure curl or wget is installed - -if ! which wget >/dev/null; then - if which curl >/dev/null; then - # Fall back to curl if no wget - USE_CURL=true - else - # If neither, try to install curl - if which yum >/dev/null; then - echo "Attempting to install curl using yum" - sudo yum install curl - USE_CURL=true - elif which apt-get >/dev/null; then - echo "Attempting to install curl using apt-get" - sudo apt-get install curl - USE_CURL=true - else - echo "I do not know how to install curl on this system. Please install curl or wget manually" - exit 1 - fi - fi -fi - -# Ensuring VirtualBox is installed -if which VBoxManage >/dev/null; then - echo "VirtualBox is installed" -else - echo "VirtualBox is not installed" - if which yum >/dev/null; then - echo "Attempting to install VirtualBox using yum" - sudo yum install VirtualBox - elif which apt-get >/dev/null; then - echo "Attempting to install VirtualBox using apt-get" - sudo apt-get install virtualbox-ose - else - echo "I do not know how to install VirtualBox on this system. Please install manually" - exit 1 - fi -fi - -mkdir -p "$INSTALL_DIRECTORY" - -cd "$INSTALL_DIRECTORY" - -# Download and extract the water-bomb .img file -if [ -z "$USE_CURL" ]; then - wget --no-clobber "http://download.baserock.org/baserock/$DEVEL_IMAGE_NAME.img.gz" -else - if ! [ -e "$DEVEL_IMAGE_NAME.img.gz" ]; then - curl -O "http://download.baserock.org/baserock/$DEVEL_IMAGE_NAME.img.gz" - fi -fi - -if [ -e $DEVEL_IMAGE_NAME.img ]; then - echo "Development image has already been decompressed" -else - echo "Decompressing development image" - gzip -dc "$DEVEL_IMAGE_NAME.img.gz" >"$DEVEL_IMAGE_NAME.img" -fi - -# Convert the .img file into a VirtualBox .vdi and create the virtual machine -VBoxManage convertdd "$DEVEL_IMAGE_NAME.img" "$VM_NAME.vdi" -VBoxManage createvm --name "$VM_VBOX_NAME" --ostype Linux26_64 --register - - -# Configure the virtual machine -VBoxManage modifyvm "$VM_VBOX_NAME" --ioapic on --memory 1024 --nic1 nat - - -# Configure the virtual machine's first hard disk -VBoxManage storagectl "$VM_VBOX_NAME" --name "SATA Controller" --add sata --bootable on --sataportcount 2 - -VBoxManage storageattach "$VM_VBOX_NAME" --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium "$VM_NAME.vdi" - - -# Configure the /src partition -VBoxManage createhd --filename "$VM_NAME-src.vdi" --size $((30*1024)) - -VBoxManage storageattach "$VM_VBOX_NAME" --storagectl "SATA Controller" --port 1 --device 0 --type hdd --medium "$VM_NAME-src.vdi" - -cd - >/dev/null |