sync-vm with torrent support
This commit is contained in:
parent
50cf61844c
commit
399c3d0d66
7 changed files with 329 additions and 12 deletions
|
@ -10,7 +10,7 @@ Create a new clone, start the vm (if not yet running) and run virt-viewer.
|
|||
Squid-Proxy will be started too.
|
||||
User Home will be mounted on /media/USERNAME/home
|
||||
-n new clone will be created, even if exists
|
||||
-s qemu:///session instead of default qemu:///system
|
||||
-s qemu:///system instead of default qemu:///session
|
||||
EOF
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@ exit_script() {
|
|||
kill -- -$$ # Sends SIGTERM to child/sub processes
|
||||
}
|
||||
|
||||
QEMU='qemu:///system'
|
||||
QEMU='qemu:///session'
|
||||
|
||||
NEWCLONE=0
|
||||
|
||||
|
@ -31,7 +31,7 @@ while getopts ':ns' OPTION; do
|
|||
NEWCLONE=1
|
||||
;;
|
||||
s)
|
||||
QEMU='qemu:///session'
|
||||
QEMU='qemu:///system'
|
||||
;;
|
||||
?)
|
||||
show_help
|
||||
|
@ -49,14 +49,15 @@ if [[ $# -ne 1 ]] ; then
|
|||
fi
|
||||
|
||||
VM_NAME=$1
|
||||
VM_DIR="/tmp/${UID}/vmimages"
|
||||
|
||||
if [[ ! -f "/var/lib/libvirt/images/${VM_NAME}.qcow2" ]]; then
|
||||
if [[ ! -f "/var/lib/libvirt/images/${VM_NAME}.qcow2" && ! -f "${VM_DIR}/${VM_NAME}.qcow2" ]]; then
|
||||
echo "no base VM disk '${VM_NAME}.qcow2' found" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# check, if we have to start squid
|
||||
if [[ ! -f "/tmp/squid.pid" ]]; then
|
||||
if ! killall -s 0 squid; then
|
||||
echo "starting squid."
|
||||
/usr/sbin/squid -f /etc/squid/squid-usermode.conf
|
||||
fi
|
||||
|
@ -68,7 +69,6 @@ if ! findmnt "/media/${USER}/home"; then
|
|||
fi
|
||||
|
||||
export XDG_CONFIG_HOME="/tmp/${UID}/.config"
|
||||
VM_DIR="/tmp/${UID}/vmimages"
|
||||
|
||||
if ! virsh --connect="${QEMU}" list | grep "${VM_NAME}-clone"; then
|
||||
echo "VM not yet running. Try to clone and start."
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue