mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-08-24 15:36:27 +00:00
Implemented BlackListModules
This commit is contained in:
parent
8fb605e8f2
commit
8bbf1b3fec
2 changed files with 14 additions and 3 deletions
|
@ -41,7 +41,8 @@ def tasks(tasklist, manifest):
|
||||||
apt.AptSources(),
|
apt.AptSources(),
|
||||||
apt.AptUpgrade(),
|
apt.AptUpgrade(),
|
||||||
boot.ConfigureGrub(),
|
boot.ConfigureGrub(),
|
||||||
boot.ModifyFstab())
|
boot.ModifyFstab(),
|
||||||
|
boot.BlackListModules())
|
||||||
|
|
||||||
from common.tasks import TriggerRollback
|
from common.tasks import TriggerRollback
|
||||||
tasklist.add(TriggerRollback())
|
tasklist.add(TriggerRollback())
|
||||||
|
|
|
@ -36,17 +36,27 @@ class ConfigureGrub(Task):
|
||||||
|
|
||||||
|
|
||||||
class ModifyFstab(Task):
|
class ModifyFstab(Task):
|
||||||
description = 'Add root volume to the fstab'
|
description = 'Adding root volume to the fstab'
|
||||||
phase = phases.system_modification
|
phase = phases.system_modification
|
||||||
|
|
||||||
def run(self, info):
|
def run(self, info):
|
||||||
fstab_path = os.path.join(info.root, 'etc/fstab')
|
|
||||||
mount_opts = ['defaults']
|
mount_opts = ['defaults']
|
||||||
if info.manifest.volume['filesystem'].lower() in ['ext2', 'ext3', 'ext4']:
|
if info.manifest.volume['filesystem'].lower() in ['ext2', 'ext3', 'ext4']:
|
||||||
mount_opts.append('barrier=0')
|
mount_opts.append('barrier=0')
|
||||||
if info.manifest.volume['filesystem'].lower() == 'xfs':
|
if info.manifest.volume['filesystem'].lower() == 'xfs':
|
||||||
mount_opts.append('nobarrier')
|
mount_opts.append('nobarrier')
|
||||||
|
fstab_path = os.path.join(info.root, 'etc/fstab')
|
||||||
with open(fstab_path, 'a') as fstab:
|
with open(fstab_path, 'a') as fstab:
|
||||||
fstab.write(('/dev/xvda1 / {filesystem} {mount_opts} 1 1'
|
fstab.write(('/dev/xvda1 / {filesystem} {mount_opts} 1 1'
|
||||||
.format(filesystem=info.manifest.volume['filesystem'].lower(),
|
.format(filesystem=info.manifest.volume['filesystem'].lower(),
|
||||||
mount_opts=','.join(mount_opts))))
|
mount_opts=','.join(mount_opts))))
|
||||||
|
|
||||||
|
|
||||||
|
class BlackListModules(Task):
|
||||||
|
description = 'Blacklisting kernel modules'
|
||||||
|
phase = phases.system_modification
|
||||||
|
|
||||||
|
def run(self, info):
|
||||||
|
blacklist_path = os.path.join(info.root, 'etc/modprobe.d/blacklist.conf')
|
||||||
|
with open(blacklist_path, 'a') as blacklist:
|
||||||
|
blacklist.write(('# disable pc speaker\nblacklist pcspkr'))
|
||||||
|
|
Loading…
Add table
Reference in a new issue