Created
September 22, 2014 16:50
-
-
Save scollier/0902c4fb3461e2b26931 to your computer and use it in GitHub Desktop.
create a bare fedora 20 qcow2 image
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
#!/bin/bash | |
SIZE="15" | |
ROOTPASS="password" | |
OUTPUTDIR="output" | |
VMEXISTS=$(virsh list --all | grep -i test) | |
if [ ! -d "$OUTPUTDIR" ]; then | |
mkdir ./"$OUTPUTDIR" | |
fi | |
if [ -f "$OUTPUTDIR/fedora.qcow2" ]; then | |
echo "images already exists" | |
exit 0 | |
fi | |
virt-builder fedora-20 \ | |
--output "$OUTPUTDIR"/fedora.qcow2 \ | |
--format qcow2 \ | |
--size "$SIZE"G \ | |
--root-password password:"$ROOTPASS" \ | |
--run-command 'touch /.autorelabel' | |
# deploy the image | |
virt-install --import --name test --ram 1024 --vcpus 1 --disk path=$(pwd)/"$OUTPUTDIR"/fedora.qcow2,format=qcow2,bus=virtio --network bridge=virbr0 --force |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment