1
1
Fork 0

added createvm.sh

This commit is contained in:
David Starzengruber 2011-04-10 22:12:07 +02:00
parent 7989804f6c
commit 55139c11e4
1 changed files with 58 additions and 0 deletions

58
kvm/createvm.sh Executable file
View File

@ -0,0 +1,58 @@
#!/bin/bash
if [ $(whoami) = "root" ]; then
:
else
echo "only root can do this"
exit 1
fi
echo "hostname?"
read hostname
echo "username?"
read username
echo "architecture? [amd64]"
read arch
echo "disksize? [8]"
read disksize
if [ -z $disksize ]; then
disksize=8192
else
disksize=$((disksize*1024))
fi
if [ -z $arch ]; then
arch="amd64"
fi
clear
echo
echo "a virtual machine with following details will be created in $(pwd)"
echo
echo "hostname: $hostname"
echo "os: lucid lynx"
echo "architecture: $arch"
echo "disksize: $disksize"
echo "password: password"
echo "proceed? [yes]"
read proceed
if [ -z $proceed ]; then
proceed="yes"
fi
if [ $proceed = "yes" ]; then
:
else
exit 1
fi
ubuntu-vm-builder kvm lucid --arch "$arch" --mem '512' --rootsize "$disksize" --swapsize '1024' --kernel-flavour 'virtual' --hostname "$hostname" --domain 'socialnerds.org' --mirror 'http://roxy.socialnerds.org/ubuntu' --components 'main,restricted,universe,multiverse' --addpkg "ssh" --name 'creator' --user "$username" --pass 'password'
echo
echo "creation finished"
exit 0