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

56 lines
1.7 KiB
Python
Raw Normal View History

2013-06-09 16:25:59 +02:00
from base import Task
from common import phases
2013-05-02 19:13:35 +02:00
class HostPackages(Task):
2013-06-09 20:29:54 +02:00
description = 'Determining required host packages'
2013-06-23 22:12:29 +02:00
phase = phases.preparation
2013-06-09 20:29:54 +02:00
2013-05-02 19:13:35 +02:00
def run(self, info):
super(HostPackages, self).run(info)
packages = set(['debootstrap',
# To make sure a volume is not busy before unmounting we need lsof
'lsof',
])
2013-05-16 08:00:28 +02:00
if info.manifest.volume['filesystem'] == 'xfs':
2013-05-02 19:13:35 +02:00
packages.add('xfsprogs')
2013-05-16 08:00:28 +02:00
info.host_packages = packages
2013-05-02 19:13:35 +02:00
class ImagePackages(Task):
2013-06-09 20:29:54 +02:00
description = 'Determining required image packages'
2013-06-23 22:12:29 +02:00
phase = phases.preparation
2013-06-09 20:29:54 +02:00
2013-05-02 19:13:35 +02:00
def run(self, info):
super(ImagePackages, self).run(info)
2013-05-16 08:00:28 +02:00
manifest = info.manifest
2013-05-02 19:13:35 +02:00
# Add some basic packages we are going to need
include = set(['udev',
'openssh-server',
# We could bootstrap without locales, but things just suck without them, error messages etc.
'locales',
# Needed for the init scripts
'file',
# isc-dhcp-client doesn't work properly with ec2
'dhcpcd',
])
if manifest.virtualization == 'pvm':
include.add('grub-pc')
2013-06-26 20:14:37 +02:00
2013-05-02 19:13:35 +02:00
exclude = set(['isc-dhcp-client',
'isc-dhcp-common',
])
2013-06-26 20:14:37 +02:00
2013-05-02 19:13:35 +02:00
# In squeeze, we need a special kernel flavor for xen
kernels = {'squeeze': {'amd64': 'linux-image-xen-amd64',
'i386': 'linux-image-xen-686', },
'wheezy': {'amd64': 'linux-image-amd64',
'i386': 'linux-image-686', }, }
include.add(kernels.get(manifest.system['release']).get(manifest.system['architecture']))
2013-06-26 20:14:37 +02:00
2013-05-02 19:13:35 +02:00
include = include.union(manifest.system['packages'])
2013-06-26 20:14:37 +02:00
2013-05-16 08:00:28 +02:00
info.img_packages = include, exclude