diff options
Diffstat (limited to 'x86_64-generic/run-image')
-rwxr-xr-x | x86_64-generic/run-image | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/x86_64-generic/run-image b/x86_64-generic/run-image deleted file mode 100755 index bf3dfa9..0000000 --- a/x86_64-generic/run-image +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -set -e - -# Usage: run-image IMAGE_FILE -IMAGE_FILE="$1" - -if [ -z "$IMAGE_FILE" ]; then - echo "The image to run must be specified" - exit 1 -fi - -# Extract an .img.gz to a .img -if echo "$IMAGE_FILE" | grep -q "\.gz$"; then - EXTRACTED_FILE=$(echo "$IMAGE_FILE" | sed 's|\(.*\)\.gz$|\1|') - if [ ! -e "$EXTRACTED_FILE" ]; then - echo "A .gz file was specified. Decompressing." - gzip -dc "$IMAGE_FILE" >"$EXTRACTED_FILE" - fi - IMAGE_FILE="$EXTRACTED_FILE" -fi - -# Verify the file is of correct type -if ! echo "$IMAGE_FILE" | grep -q "\.img$"; then - echo "Specified file is not a disk image" - exit 1 -fi - -IMAGE_BASEPATH=$(echo "$IMAGE_FILE" | sed 's|\(.*\)\.img|\1|') -IMAGE_BASENAME=$(basename "$IMAGE_FILE" .img) -IMAGE_VBOXNAME=$(basename "$IMAGE_FILE" .img | sed 's|\s|\.|g') - -echo "ensuring vm is created" - -# Convert the .img file into a VirtualBox .vdi if no .vdi exists -if [ ! -e "$IMAGE_BASEPATH.vdi" ]; then - VBoxManage convertdd "$IMAGE_BASEPATH.img" "$IMAGE_BASEPATH.vdi" -fi - -# Create a virtual machine if none exists. -if ! VBoxManage showvminfo "$IMAGE_VBOXNAME" &>/dev/null; then - VBoxManage createvm --name "$IMAGE_VBOXNAME" --ostype Linux26_64 --register -fi - - -# Configure the virtual machine -VBoxManage modifyvm "$IMAGE_VBOXNAME" --ioapic on --memory 1024 --nic1 nat -# Ensure the SATA controller is set up -if ! VBoxManage showvminfo "$IMAGE_VBOXNAME" | grep "SATA Controller" &>/dev/null; then - VBoxManage storagectl "$IMAGE_VBOXNAME" --name "SATA Controller" --add sata --bootable on --sataportcount 1 -fi - -VBoxManage storageattach "$IMAGE_VBOXNAME" --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium "$IMAGE_BASEPATH.vdi" - -VBoxManage startvm "$IMAGE_VBOXNAME" |