xen-drbd

changeset 43:562d6e064e6f

Install packages into domains (apt_get_install_table)
author igor@manas.xt.vpn
date Tue Sep 23 11:40:23 2008 +0300 (2008-09-23)
parents c6d8b4bfc8d1
children cbe58da31273
files od.py xen-drbd-install.py
line diff
     1.1 --- a/od.py	Mon Sep 22 17:03:02 2008 +0300
     1.2 +++ b/od.py	Tue Sep 23 11:40:23 2008 +0300
     1.3 @@ -128,4 +128,7 @@
     1.4  debian_mirror="http://apt.eb.co.ua:9999/debian"
     1.5  apt_get_install="less tcpdump dnsutils vim ntp screen snmpd libc6-xen openssh-server"
     1.6  
     1.7 +apt_get_install_table={
     1.8 +    "vpn"   :"openvpn",
     1.9 +}
    1.10  
     2.1 --- a/xen-drbd-install.py	Mon Sep 22 17:03:02 2008 +0300
     2.2 +++ b/xen-drbd-install.py	Tue Sep 23 11:40:23 2008 +0300
     2.3 @@ -218,10 +218,13 @@
     2.4  
     2.5  def make_install_debian():
     2.6      print """
     2.7 -apt-get install debootstrap
     2.8 +apt-get install debootstrap lsof
     2.9  debootstrap %s /domU/%s %s
    2.10  chroot /domU/%s apt-get install -y --force-yes %s
    2.11 -    """ % (debian_release,domains[0],debian_mirror,domains[0],apt_get_install)
    2.12 +kill $(lsof +D /domU/%s | grep -v PID | awk '{print $2}' | sort -u) 2> /dev/null
    2.13 +sleep 2
    2.14 +kill -9 $(lsof +D /domU/%s | grep -v PID | awk '{print $2}' | sort -u) 2> /dev/null
    2.15 +    """ % (debian_release,domains[0],debian_mirror,domains[0],apt_get_install,domains[0],domains[0])
    2.16  
    2.17  def make_rsync():
    2.18      for dom in domains[1:]:
    2.19 @@ -229,6 +232,19 @@
    2.20  rsync -a /domU/%s/ /domU/%s/
    2.21          """ % (domains[0], dom)
    2.22  
    2.23 +
    2.24 +def make_install_packages():
    2.25 +    for dom in domains:
    2.26 +        try:
    2.27 +            print """
    2.28 +chroot /domU/%s apt-get install -y --force-yes %s
    2.29 +kill $(lsof +D /domU/%s | grep -v PID | awk '{print $2}' | sort -u) 2> /dev/null
    2.30 +sleep 2
    2.31 +kill -9 $(lsof +D /domU/%s | grep -v PID | awk '{print $2}' | sort -u) 2> /dev/null
    2.32 +            """ % (dom,apt_get_install_table[dom],dom,dom)
    2.33 +        except:
    2.34 +            pass
    2.35 +
    2.36  def make_etcfstab():
    2.37      i=0
    2.38      for dom in linux_domains:
    2.39 @@ -335,6 +351,7 @@
    2.40      make_mount()
    2.41      make_install_debian()
    2.42      make_rsync()
    2.43 +    make_install_packages()
    2.44      make_etc()
    2.45      make_umount()
    2.46