bootstrap-vz/bootstrapvz/providers/gce/tasks/initd.py
2016-03-02 16:28:11 -08:00

25 lines
902 B
Python

from bootstrapvz.base import Task
from bootstrapvz.common import phases
from bootstrapvz.common.tasks import kernel
from . import assets
import os.path
class AddGrowRootDisable(Task):
description = 'Add script to selectively disable growroot'
phase = phases.system_modification
successors = [kernel.UpdateInitramfs]
@classmethod
def run(cls, info):
import stat
rwxr_xr_x = (stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR |
stat.S_IRGRP | stat.S_IXGRP |
stat.S_IROTH | stat.S_IXOTH)
from shutil import copy
script_src = os.path.join(assets,
'initramfs-tools/scripts/local-premount/gce-disable-growroot')
script_dst = os.path.join(info.root,
'etc/initramfs-tools/scripts/local-premount/gce-disable-growroot')
copy(script_src, script_dst)
os.chmod(script_dst, rwxr_xr_x)