mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-08-24 15:36:27 +00:00
28 lines
882 B
Python
28 lines
882 B
Python
![]() |
from base import Task
|
||
|
from common import phases
|
||
|
|
||
|
|
||
|
class S3FStab(Task):
|
||
|
description = 'Adding the S3 root partition to the fstab'
|
||
|
phase = phases.system_modification
|
||
|
|
||
|
def run(self, info):
|
||
|
import os.path
|
||
|
root = info.volume.partition_map.root
|
||
|
|
||
|
fstab_lines = []
|
||
|
mount_opts = ['defaults']
|
||
|
fstab_lines.append('{device_path}{idx} {mountpoint} {filesystem} {mount_opts} {dump} {pass_num}'
|
||
|
.format(device_path='/dev/xvda',
|
||
|
idx=1,
|
||
|
mountpoint='/',
|
||
|
filesystem=root.filesystem,
|
||
|
mount_opts=','.join(mount_opts),
|
||
|
dump='1',
|
||
|
pass_num='1'))
|
||
|
|
||
|
fstab_path = os.path.join(info.root, 'etc/fstab')
|
||
|
with open(fstab_path, 'w') as fstab:
|
||
|
fstab.write('\n'.join(fstab_lines))
|
||
|
fstab.write('\n')
|