diff options
author | varac <varacanero@zeromail.org> | 2012-12-18 10:15:14 +0100 |
---|---|---|
committer | varac <varacanero@zeromail.org> | 2012-12-18 10:15:14 +0100 |
commit | fe1fc352ff1f7186c805ac08b37e0ab39ea22c64 (patch) | |
tree | 2c1f0419d0c5af6d840cc9be5431cf1c76425a2e | |
parent | c682814fb8532271ec30e98511a25e708a4aef0a (diff) |
added clone-baseimage.sh
-rw-r--r-- | clone-baseimage.sh | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/clone-baseimage.sh b/clone-baseimage.sh new file mode 100644 index 0000000..dde8559 --- /dev/null +++ b/clone-baseimage.sh @@ -0,0 +1,24 @@ +#!/bin/sh + +ETC='/etc/libvirt/local' +CONFIG="$ETC/clone-baseimage.conf" + +# please overwrite these defaults in $CONFIG +IMAGE='leap-baseimage-wheezy' +SRCHOST='cheetah' +SRCIMAGEPATH="/dev/vg01/$IMAGE" +DESTIMAGEPATH=$SRCIMAGEPATH + +# overwrite defaults +[ -e $CONFIG ] && . $CONFIG + + +# test on cheetah +ssh $SRCHOST "virsh list|grep -q $IMAGE" && echo "$IMAGE is up on cheetah. Stop it before cloning !" && exit 1 + +# test locally +virsh list|grep -q $IMAGE && echo "$IMAGE is up, locally. Stop it before cloning !" && exit 1 + +echo "Cloning..." +ssh $SRCHOST "dd if=$SRCIMAGEPATH" | dd of=$DESTIMAGEPATH + |