Created
June 1, 2012 13:33
-
-
Save alexisbellido/2852177 to your computer and use it in GitHub Desktop.
createvm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
root@jericho:~/scripts# cat createvm.sh | |
#!/bin/bash | |
echo "./createvm.sh HOSTNAME SUITE ARCH IP GW USER USERNAME PASS MEM" | |
echo "example: ./createvm.sh vm6 oneiric i386 192.168.0.186 192.168.0.1 username UserName password 1024" | |
BASEVM=vm1 | |
HOSTNAME=$1 | |
SUITE=$2 | |
ARCH=$3 | |
IP=$4 | |
GW=$5 | |
USER=$6 | |
USERNAME=$7 | |
PASS=$8 | |
MEM=$9 | |
echo "Creating new virtual machine with these parameters" | |
echo "HOSTNAME $HOSTNAME" | |
echo "SUITE $SUITE" | |
echo "ARCH $ARCH" | |
echo "IP $IP" | |
echo "GW $GW" | |
echo "USER $USER" | |
echo "USERNAME $USERNAME" | |
echo "PASS $PASS" | |
echo "MEM $MEM" | |
mkdir -p /var/lib/libvirt/images/$HOSTNAME/mytemplates/libvirt | |
cp /etc/vmbuilder/libvirt/* /var/lib/libvirt/images/$HOSTNAME/mytemplates/libvirt/ | |
cd /var/lib/libvirt/images/$HOSTNAME | |
cp /var/lib/libvirt/images/$BASEVM/boot.sh . | |
cp /var/lib/libvirt/images/$BASEVM/vmbuilder.partition . | |
#vmbuilder kvm ubuntu --suite=oneiric --flavour=virtual --arch=i386 -o --libvirt=qemu:///system --ip=192.168.0.183 --gw=192.168.0.1 --part=vmbuilder.partition --templates=mytemplates --user=alexis --name=Alexis --pass=tigris --addpkg=vim-nox --addpkg=unattended-upgrades --addpkg=acpid --firstboot=/var/lib/libvirt/images/$HOSTNAME/boot.sh --mem=256 --hostname=$HOSTNAME --bridge=br0 | |
vmbuilder kvm ubuntu --suite=$SUITE --flavour=virtual --arch=$ARCH -o --libvirt=qemu:///system --ip=$IP --gw=$GW --part=vmbuilder.partition --templates=mytemplates --user=$USER --name=$USERNAME --pass=$PASS --addpkg=vim-nox --addpkg=unattended-upgrades --addpkg=acpid --firstboot=/var/lib/libvirt/images/$HOSTNAME/boot.sh --mem=$MEM --hostname=$HOSTNAME --bridge=br0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment