diff --git a/bootstrapvz/common/tasks/initd.py b/bootstrapvz/common/tasks/initd.py index f4537e3..a68a944 100644 --- a/bootstrapvz/common/tasks/initd.py +++ b/bootstrapvz/common/tasks/initd.py @@ -58,7 +58,6 @@ class AdjustExpandRootScript(Task): @classmethod def run(cls, info): from ..tools import sed_i - from bootstrapvz.common.releases import jessie script = os.path.join(info.root, 'etc/init.d/expand-root') root_idx = info.volume.partition_map.root.get_index() @@ -68,5 +67,16 @@ class AdjustExpandRootScript(Task): root_device_path = 'root_device_path="{device}"'.format(device=info.volume.device_path) sed_i(script, '^root_device_path="/dev/xvda"$', root_device_path) + +class AdjustGrowpartWorkaround(Task): + description = 'Adjusting expand-root for growpart-workaround' + phase = phases.system_modification + predecessors = [AdjustExpandRootScript] + + @classmethod + def run(cls, info): + from ..tools import sed_i + from bootstrapvz.common.releases import jessie + if info.manifest.release >= jessie: sed_i(script, '^growpart="growpart"$', 'growpart-workaround') diff --git a/bootstrapvz/providers/ec2/__init__.py b/bootstrapvz/providers/ec2/__init__.py index 21749c6..5ea09d0 100644 --- a/bootstrapvz/providers/ec2/__init__.py +++ b/bootstrapvz/providers/ec2/__init__.py @@ -89,6 +89,7 @@ def resolve_tasks(taskset, manifest): if manifest.volume['partitions']['type'] != 'none': taskset.add(initd.AdjustExpandRootScript) + taskset.add(initd.AdjustGrowpartWorkaround) if manifest.system['bootloader'] == 'pvgrub': taskset.add(grub.AddGrubPackage)