From 2ece5a66e1e36f30bef3a675e8287ab8c1bcc04f Mon Sep 17 00:00:00 2001 From: Jesse Szwedko Date: Tue, 12 Jan 2016 18:33:41 +0000 Subject: [PATCH] sed in root_device_path into expand-root To make it more flexible Signed-off-by: Andrew Garrett --- bootstrapvz/common/assets/init.d/expand-root | 5 +++-- bootstrapvz/common/tasks/initd.py | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/bootstrapvz/common/assets/init.d/expand-root b/bootstrapvz/common/assets/init.d/expand-root index 43a44f9..cf3053b 100644 --- a/bootstrapvz/common/assets/init.d/expand-root +++ b/bootstrapvz/common/assets/init.d/expand-root @@ -18,14 +18,15 @@ hash growpart 2> /dev/null || { exit 1 } +root_device_path="/dev/xvda" root_index="0" -growpart /dev/xvda $root_index || { +growpart $root_device_path $root_index || { $logger "growpart failed. Unable to expand size." exit 1 } -device_path="/dev/xvda$root_index" +device_path="${root_device_path}${root_index}" filesystem=$(blkid -s TYPE -o value ${device_path}) case $filesystem in diff --git a/bootstrapvz/common/tasks/initd.py b/bootstrapvz/common/tasks/initd.py index 5b6101e..5ad65f6 100644 --- a/bootstrapvz/common/tasks/initd.py +++ b/bootstrapvz/common/tasks/initd.py @@ -59,6 +59,10 @@ class AdjustExpandRootScript(Task): def run(cls, info): from ..tools import sed_i script = os.path.join(info.root, 'etc/init.d/expand-root') + root_idx = info.volume.partition_map.root.get_index() root_index_line = 'root_index="{idx}"'.format(idx=root_idx) sed_i(script, '^root_index="0"$', root_index_line) + + root_device_path = 'root_device_path="{device}"'.format(device=info.volume.device_path) + sed_i(script, '^root_device_path="/dev/xvda"$', root_device_path)