~noskcaj/ubuntu/saucy/sflphone/merge-1.2.3-2

« back to all changes in this revision

Viewing changes to tools/vm/deploy_vm.sh

  • Committer: Package Import Robot
  • Author(s): Mark Purcell
  • Date: 2012-05-19 21:46:37 UTC
  • mfrom: (1.1.7)
  • Revision ID: package-import@ubuntu.com-20120519214637-la8rbrford5kj6m3
Tags: 1.1.0-1
* New upstream release 
  - Fixes "FTBFS with libccrtp-dev/2.0.2 from experimental" (Closes: #663282)
* NEW Maintainer: Debian VoIP Team - Thanks Francois for your work.
  - (Closes: #665789: O: sflphone -- SIP and IAX2 compatible VoIP phone)
* Added Build-Depends: libdbus-c++-bin
* Add gcc47-fixes.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/bin/bash
2
 
 
3
 
# Requirements:
4
 
 
5
 
# 1) apt-get install kvm virsh
6
 
 
7
 
# 2) Make sure kvm and kvm_intel are installed
8
 
# lsmod | grep kvm
9
 
 
10
 
# 3) Get a .iso file for the coresponding distro
11
 
 
12
 
# 4) Install a new VM on a disk image
13
 
# kvm-img create vm0-ubuntu-10.04.1-desktop-i386.qcow2 -f qcow2 6G
14
 
# kvm -k en-us -usbdevice tablet -hda vm0-ubuntu-10.04.1-desktop-i386.qcow2 -cdrom ubuntu-10.04.1-desktop-i386.iso -boot d -m 512
15
 
# kvm -k en-us -usbdevice tablet -hda vm0-ubuntu-10.04.1-desktop-i386.qcow2 -cdrom ubuntu-10.04.1-desktop-i386.iso -boot c -m 512
16
 
 
17
 
# 5) Create the VM
18
 
# virsh -c qemu:///system define Ubuntu-10.04-i386-on-KVM.xml
19
 
 
20
 
# 6) Copy Host's public ssh key in order to avoid password request
21
 
# ssh-copy-id sflphone@machine
22
 
 
23
 
# 7) Take a snapshot of this disk image
24
 
# kvm-img snapshot -c tag_name disk_image_filename
25
 
 
26
 
# 8) Add NOPASSWORD in sudoers
27
 
 
28
 
VM=Ubuntu-10.04-i386-on-KVM
29
 
 
30
 
VIRSH="virsh -c qemu:///system"
31
 
 
32
 
# Get the full path to vm's
33
 
DISK_IMG=$($VIRSH dumpxml "${VM}"|grep source.file|cut -d"'" -f2)
34
 
echo "Disk Image: $DISK_IMG"
35
 
# Get MAC address for this vm
36
 
MAC_ADDR=$($VIRSH dumpxml "${VM}"|grep mac.address|cut -d"'" -f2)
37
 
echo "Mac Address: $MAC_ADDR"
38
 
 
39
 
# Reset disk to last snapshot
40
 
LAST_SNAPSHOT_ID=$(kvm-img snapshot -l $DISK_IMG|tail -n 1|cut -d' ' -f1)
41
 
kvm-img snapshot -a $LAST_SNAPSHOT_ID $DISK_IMG
42
 
 
43
 
# Create VM
44
 
$VIRSH start $VM
45
 
 
46
 
# Get its IP address
47
 
echo -n "Waiting for IP address..."
48
 
LAST_STAMP=$(grep $MAC_ADDR /var/lib/misc/dnsmasq.leases | cut -d' ' -f1)
49
 
while [ 1 ]
50
 
do
51
 
  NEXT_STAMP=$(grep $MAC_ADDR /var/lib/misc/dnsmasq.leases | cut -d' ' -f1)
52
 
  if [ $LAST_STAMP != $NEXT_STAMP ]; then
53
 
    IPADDR=$(grep $MAC_ADDR /var/lib/misc/dnsmasq.leases | cut -d' ' -f3)
54
 
    break
55
 
  fi
56
 
  echo -n "."
57
 
  sleep 0.5
58
 
done
59
 
echo " got $IPADDR"
60
 
 
61
 
HOST=sflphone@$IPADDR
62
 
 
63
 
# Connect ssh
64
 
echo -n "Waiting for ssh to start..."
65
 
while [ 1 ]; do
66
 
  ssh $HOST echo Connected && break
67
 
  sleep 2
68
 
done
69
 
 
70
 
# create an archive of the repository
71
 
# git archive --format=tar -o sflphone.tar HEAD
72
 
# gzip sflphone.tar
73
 
# scp -C sflphone.tar.gz $HOST
74
 
 
75
 
# sudo add-apt-repository ppa:savoirfairelinux
76
 
 
77
 
# sudo apt-get build-dep sflphone-common
78
 
# sudo apt-get build-dep sflphone-client-gnome
79
 
 
80
 
 
81
 
 
82