mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-08-22 09:50:37 +00:00
Extlinux support
The bootloader is now specified in the manifest
This commit is contained in:
parent
68368b1782
commit
44f3296426
17 changed files with 69 additions and 14 deletions
|
@ -20,11 +20,12 @@
|
|||
"properties": {
|
||||
"release": { "enum": ["wheezy"] },
|
||||
"architecture": { "enum": ["i386", "amd64"] },
|
||||
"bootloader": { "enum": ["pvgrub", "grub", "extlinux"] },
|
||||
"timezone": { "type": "string" },
|
||||
"locale": { "type": "string" },
|
||||
"charmap": { "type": "string" }
|
||||
},
|
||||
"required": ["release", "architecture", "timezone", "locale", "charmap"]
|
||||
"required": ["release", "architecture", "bootloader", "timezone", "locale", "charmap"]
|
||||
},
|
||||
"packages": {
|
||||
"type": "object",
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
from common.tasks import workspace
|
||||
from common.tasks import packages
|
||||
from common.tasks import host
|
||||
from common.tasks import boot
|
||||
from common.tasks import bootstrap
|
||||
from common.tasks import volume
|
||||
from common.tasks import filesystem
|
||||
|
@ -62,6 +63,11 @@ locale_set = [locale.LocaleBootstrapPackage,
|
|||
]
|
||||
|
||||
|
||||
bootloader_set = {'grub': [boot.AddGrubPackage, boot.InstallGrub],
|
||||
'extlinux': [boot.AddExtlinuxPackage, boot.InstallExtLinux],
|
||||
}
|
||||
|
||||
|
||||
def get_fs_specific_set(partitions):
|
||||
task_set = {'ext2': [filesystem.TuneVolumeFS],
|
||||
'ext3': [filesystem.TuneVolumeFS],
|
||||
|
|
|
@ -30,6 +30,15 @@ class DisableGetTTYs(Task):
|
|||
sed_i(inittab_path, '^' + i + ttyx + i, '#' + i + ttyx + i)
|
||||
|
||||
|
||||
class AddGrubPackage(Task):
|
||||
description = 'Adding grub package'
|
||||
phase = phases.preparation
|
||||
predecessors = [apt.AddDefaultSources]
|
||||
|
||||
def run(self, info):
|
||||
info.packages.add('grub-pc')
|
||||
|
||||
|
||||
class InstallGrub(Task):
|
||||
description = 'Installing grub'
|
||||
phase = phases.system_modification
|
||||
|
@ -91,3 +100,24 @@ class InstallGrub(Task):
|
|||
|
||||
if isinstance(info.volume, LoopbackVolume):
|
||||
remount(info.volume, unlink_fn)
|
||||
|
||||
|
||||
class AddExtlinuxPackage(Task):
|
||||
description = 'Adding extlinux package'
|
||||
phase = phases.preparation
|
||||
predecessors = [apt.AddDefaultSources]
|
||||
|
||||
def run(self, info):
|
||||
info.packages.add('extlinux')
|
||||
|
||||
|
||||
class InstallExtLinux(Task):
|
||||
description = 'Installing extlinux'
|
||||
phase = phases.system_modification
|
||||
predecessors = [apt.AptUpgrade]
|
||||
|
||||
def run(self, info):
|
||||
from common.tools import log_check_call
|
||||
log_check_call(['/usr/sbin/chroot', info.root,
|
||||
'/usr/bin/extlinux',
|
||||
'--install', '/boot'])
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
"system": {
|
||||
"release": "wheezy",
|
||||
"architecture": "amd64",
|
||||
"bootloader": "extlinux",
|
||||
"timezone": "UTC",
|
||||
"locale": "en_US",
|
||||
"charmap": "UTF-8"
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
"system": {
|
||||
"release": "wheezy",
|
||||
"architecture": "amd64",
|
||||
"bootloader": "pvgrub",
|
||||
"timezone": "UTC",
|
||||
"locale": "en_US",
|
||||
"charmap": "UTF-8"
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
"system": {
|
||||
"release": "wheezy",
|
||||
"architecture": "i386",
|
||||
"bootloader": "pvgrub",
|
||||
"timezone": "UTC",
|
||||
"locale": "en_US",
|
||||
"charmap": "UTF-8"
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
"system": {
|
||||
"release": "wheezy",
|
||||
"architecture": "amd64",
|
||||
"bootloader": "pvgrub",
|
||||
"timezone": "UTC",
|
||||
"locale": "en_US",
|
||||
"charmap": "UTF-8"
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
"system": {
|
||||
"release": "wheezy",
|
||||
"architecture": "amd64",
|
||||
"bootloader": "pvgrub",
|
||||
"timezone": "UTC",
|
||||
"locale": "en_US",
|
||||
"charmap": "UTF-8"
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
"system": {
|
||||
"release": "wheezy",
|
||||
"architecture": "amd64",
|
||||
"bootloader": "pvgrub",
|
||||
"timezone": "UTC",
|
||||
"locale": "en_US",
|
||||
"charmap": "UTF-8"
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
"system": {
|
||||
"release": "wheezy",
|
||||
"architecture": "amd64",
|
||||
"bootloader": "grub",
|
||||
"timezone": "UTC",
|
||||
"locale": "en_US",
|
||||
"charmap": "UTF-8"
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
"system": {
|
||||
"release": "wheezy",
|
||||
"architecture": "amd64",
|
||||
"bootloader": "grub",
|
||||
"timezone": "UTC",
|
||||
"locale": "en_US",
|
||||
"charmap": "UTF-8"
|
||||
|
|
|
@ -67,10 +67,11 @@ def resolve_tasks(tasklist, manifest):
|
|||
|
||||
tasks.ami.RegisterAMI)
|
||||
|
||||
if manifest.virtualization == 'pvm':
|
||||
tasklist.add(tasks.boot.ConfigurePVGrub)
|
||||
if manifest.system['bootloader'] == 'pvgrub':
|
||||
tasklist.add(boot.AddGrubPackage, tasks.boot.ConfigurePVGrub)
|
||||
else:
|
||||
tasklist.add(boot.InstallGrub)
|
||||
from common.task_sets import bootloader_set
|
||||
tasklist.add(*bootloader_set.get(manifest.system['bootloader']))
|
||||
|
||||
backing_specific_tasks = {'ebs': [tasks.ebs.Create,
|
||||
tasks.ebs.Attach,
|
||||
|
|
|
@ -6,8 +6,7 @@ class Manifest(base.Manifest):
|
|||
def validate(self, data):
|
||||
super(Manifest, self).validate(data)
|
||||
from os import path
|
||||
schema_path = path.join(path.dirname(__file__), 'manifest-schema.json')
|
||||
self.schema_validate(data, schema_path)
|
||||
self.schema_validate(data, path.join(path.dirname(__file__), 'manifest-schema.json'))
|
||||
if data['volume']['backing'] == 'ebs':
|
||||
volume_size = self._calculate_volume_size(data['volume']['partitions'])
|
||||
if volume_size % 1024 != 0:
|
||||
|
@ -15,8 +14,12 @@ class Manifest(base.Manifest):
|
|||
'(MBR partitioned volumes are 1MB larger than specified, for the post-mbr gap)')
|
||||
raise ManifestError(msg, self)
|
||||
else:
|
||||
schema_path = path.join(path.dirname(__file__), 'manifest-schema-s3.json')
|
||||
self.schema_validate(data, schema_path)
|
||||
self.schema_validate(data, path.join(path.dirname(__file__), 'manifest-schema-s3.json'))
|
||||
|
||||
if data['virtualization'] == 'pvm' and data['system']['bootloader'] != 'pvgrub':
|
||||
raise ManifestError('Paravirtualized AMIs only support pvgrub as a bootloader', self)
|
||||
if data['virtualization'] == 'hvm' and data['system']['bootloader'] != 'extlinux':
|
||||
raise ManifestError('HVM AMIs only support extlinux as a bootloader', self)
|
||||
|
||||
def parse(self, data):
|
||||
super(Manifest, self).parse(data)
|
||||
|
|
|
@ -12,7 +12,6 @@ class DefaultPackages(Task):
|
|||
info.packages.add('openssh-server')
|
||||
info.packages.add('file') # Needed for the init scripts
|
||||
info.packages.add('dhcpcd') # isc-dhcp-client doesn't work properly with ec2
|
||||
info.packages.add('grub-pc')
|
||||
|
||||
info.exclude_packages.add('isc-dhcp-client')
|
||||
info.exclude_packages.add('isc-dhcp-common')
|
||||
|
|
|
@ -5,7 +5,6 @@ from common.tasks import loopback
|
|||
from common.tasks import partitioning
|
||||
from common.tasks import filesystem
|
||||
from common.tasks import bootstrap
|
||||
from common.tasks import boot
|
||||
from common.tasks import security
|
||||
from common.tasks import network
|
||||
from common.tasks import initd
|
||||
|
@ -29,6 +28,9 @@ def resolve_tasks(tasklist, manifest):
|
|||
tasklist.add(*apt_set)
|
||||
tasklist.add(*locale_set)
|
||||
|
||||
from common.task_sets import bootloader_set
|
||||
tasklist.add(*bootloader_set.get(manifest.system['bootloader']))
|
||||
|
||||
if manifest.volume['partitions']['type'] != 'none':
|
||||
from common.task_sets import partitioning_set
|
||||
tasklist.add(*partitioning_set)
|
||||
|
@ -37,7 +39,6 @@ def resolve_tasks(tasklist, manifest):
|
|||
|
||||
loopback.Create,
|
||||
|
||||
boot.InstallGrub,
|
||||
security.EnableShadowConfig,
|
||||
network.RemoveDNSInfo,
|
||||
network.ConfigureNetworkIF,
|
||||
|
|
|
@ -11,6 +11,15 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"system": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"bootloader": {
|
||||
"type": "string",
|
||||
"enum": ["grub"]
|
||||
}
|
||||
}
|
||||
},
|
||||
"volume": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
|
|
@ -9,9 +9,6 @@ class DefaultPackages(Task):
|
|||
predecessors = [apt.AddDefaultSources]
|
||||
|
||||
def run(self, info):
|
||||
# Add some basic packages we are going to need
|
||||
info.packages.add('grub2')
|
||||
|
||||
kernels = {'amd64': 'linux-image-amd64',
|
||||
'i386': 'linux-image-686', }
|
||||
info.packages.add(kernels.get(info.manifest.system['architecture']))
|
||||
|
|
Loading…
Add table
Reference in a new issue