david/scripts-archive
david
/
scripts-archive
Archived
1
0
Fork 0
This repository has been archived on 2022-04-16. You can view files and clone it, but cannot push or open issues or pull requests.
scripts-archive/kvm-tools/archive/createvm.sh

59 lines
1.1 KiB
Bash

#!/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