bootstrap-vz/providers/virtualbox/tasks/packages.py

48 lines
1.5 KiB
Python
Raw Normal View History

2013-07-10 10:49:45 +02:00
from base import Task
from common import phases
from common.tasks import packages
from common.tasks.host import CheckPackages
2013-07-10 10:49:45 +02:00
class HostPackages(Task):
description = 'Determining required host packages'
phase = phases.preparation
before = [CheckPackages]
after = [packages.HostPackages]
2013-07-10 10:49:45 +02:00
def run(self, info):
info.host_packages.update(['qemu-utils', 'parted', 'grub2', 'sysv-rc'])
2013-07-10 10:49:45 +02:00
if info.manifest.volume['filesystem'] == 'xfs':
info.host_packages.add('xfsprogs')
2013-07-10 10:49:45 +02:00
class ImagePackages(Task):
description = 'Determining required image packages'
phase = phases.preparation
after = [packages.ImagePackages]
2013-07-10 10:49:45 +02:00
def run(self, info):
manifest = info.manifest
include, exclude = info.img_packages
2013-07-10 10:49:45 +02:00
# Add some basic packages we are going to need
include.update(['parted',
2013-08-11 18:33:49 +02:00
'kpartx',
2013-07-10 10:49:45 +02:00
# Needed for the init scripts
'file',
# isc-dhcp-client doesn't work properly with ec2
'dhcpcd',
2013-08-10 17:23:56 +02:00
'chkconfig',
'openssh-client'
])
2013-07-10 10:49:45 +02:00
exclude.update(['isc-dhcp-client',
2013-07-10 10:49:45 +02:00
'isc-dhcp-common',
])
2013-07-10 10:49:45 +02:00
# In squeeze, we need a special kernel flavor for xen
kernels = {'squeeze': {'amd64': 'linux-image-amd64',
'i386': 'linux-image-686', },
2013-07-10 10:49:45 +02:00
'wheezy': {'amd64': 'linux-image-amd64',
'i386': 'linux-image-686', }, }
include.add(kernels.get(manifest.system['release']).get(manifest.system['architecture']))