2014-03-23 23:12:07 +01:00
|
|
|
from bootstrapvz.base import Task
|
|
|
|
from bootstrapvz.common import phases
|
2014-11-29 13:46:57 -08:00
|
|
|
from bootstrapvz.common.tasks import kernel
|
2013-09-22 15:41:43 +02:00
|
|
|
import os.path
|
|
|
|
|
|
|
|
|
2015-07-30 09:40:01 +02:00
|
|
|
class InstallDHCPCD(Task):
|
|
|
|
description = 'Replacing isc-dhcp with dhcpcd'
|
|
|
|
phase = phases.preparation
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def run(cls, info):
|
|
|
|
# isc-dhcp-client before jessie doesn't work properly with ec2
|
|
|
|
info.packages.add('dhcpcd')
|
|
|
|
info.exclude_packages.add('isc-dhcp-client')
|
|
|
|
info.exclude_packages.add('isc-dhcp-common')
|
|
|
|
|
|
|
|
|
2013-09-22 15:41:43 +02:00
|
|
|
class EnableDHCPCDDNS(Task):
|
|
|
|
description = 'Configuring the DHCP client to set the nameservers'
|
|
|
|
phase = phases.system_modification
|
|
|
|
|
2014-01-05 15:57:11 +01:00
|
|
|
@classmethod
|
|
|
|
def run(cls, info):
|
2015-07-30 09:40:01 +02:00
|
|
|
from bootstrapvz.common.tools import sed_i
|
|
|
|
dhcpcd = os.path.join(info.root, 'etc/default/dhcpcd')
|
|
|
|
sed_i(dhcpcd, '^#*SET_DNS=.*', 'SET_DNS=\'yes\'')
|
2013-12-30 12:15:28 +01:00
|
|
|
|
|
|
|
|
|
|
|
class AddBuildEssentialPackage(Task):
|
|
|
|
description = 'Adding build-essential package'
|
|
|
|
phase = phases.preparation
|
|
|
|
|
2014-01-05 15:57:11 +01:00
|
|
|
@classmethod
|
|
|
|
def run(cls, info):
|
2013-12-30 12:15:28 +01:00
|
|
|
info.packages.add('build-essential')
|
|
|
|
|
|
|
|
|
|
|
|
class InstallEnhancedNetworking(Task):
|
2014-11-29 13:46:57 -08:00
|
|
|
description = 'Installing enhanced networking kernel driver using DKMS'
|
|
|
|
phase = phases.system_modification
|
|
|
|
successors = [kernel.UpdateInitramfs]
|
2013-12-30 12:15:28 +01:00
|
|
|
|
2014-01-05 15:57:11 +01:00
|
|
|
@classmethod
|
|
|
|
def run(cls, info):
|
2015-06-10 14:41:02 -03:00
|
|
|
version = '2.16.1'
|
2014-11-29 13:46:57 -08:00
|
|
|
drivers_url = 'http://downloads.sourceforge.net/project/e1000/ixgbevf stable/%s/ixgbevf-%s.tar.gz' % (version, version)
|
|
|
|
archive = os.path.join(info.root, 'tmp', 'ixgbevf-%s.tar.gz' % (version))
|
|
|
|
module_path = os.path.join(info.root, 'usr', 'src', 'ixgbevf-%s' % (version))
|
2013-12-30 12:15:28 +01:00
|
|
|
|
|
|
|
import urllib
|
|
|
|
urllib.urlretrieve(drivers_url, archive)
|
|
|
|
|
2014-03-23 23:12:07 +01:00
|
|
|
from bootstrapvz.common.tools import log_check_call
|
2014-11-29 13:46:57 -08:00
|
|
|
log_check_call(['tar', '--ungzip',
|
|
|
|
'--extract',
|
|
|
|
'--file', archive,
|
|
|
|
'--directory', os.path.join(info.root, 'usr', 'src')])
|
|
|
|
|
|
|
|
with open(os.path.join(module_path, 'dkms.conf'), 'w') as dkms_conf:
|
|
|
|
dkms_conf.write("""PACKAGE_NAME="ixgbevf"
|
|
|
|
PACKAGE_VERSION="%s"
|
|
|
|
CLEAN="cd src/; make clean"
|
|
|
|
MAKE="cd src/; make BUILD_KERNEL=${kernelver}"
|
|
|
|
BUILT_MODULE_LOCATION[0]="src/"
|
|
|
|
BUILT_MODULE_NAME[0]="ixgbevf"
|
|
|
|
DEST_MODULE_LOCATION[0]="/updates"
|
|
|
|
DEST_MODULE_NAME[0]="ixgbevf"
|
|
|
|
AUTOINSTALL="yes"
|
|
|
|
""" % (version))
|
|
|
|
|
|
|
|
for task in ['add', 'build', 'install']:
|
|
|
|
# Invoke DKMS task using specified kernel module (-m) and version (-v)
|
|
|
|
log_check_call(['chroot', info.root,
|
2015-06-29 23:25:02 +00:00
|
|
|
'dkms', task, '-m', 'ixgbevf', '-v', version, '-k', info.kernel_version])
|