sed in root_device_path into expand-root

To make it more flexible

Signed-off-by: Andrew Garrett <andrew.garrett@getbraintree.com>
This commit is contained in:
Jesse Szwedko 2016-01-12 18:33:41 +00:00 committed by Jonh
parent 4e94880b2a
commit 2ece5a66e1
2 changed files with 7 additions and 2 deletions

View file

@ -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

View file

@ -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)