bootstrap-vz/common/tasks/boot.py

30 lines
865 B
Python
Raw Normal View History

from base import Task
from common import phases
import os
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\n'
'blacklist pcspkr'))
class DisableGetTTYs(Task):
description = 'Disabling getty processes'
phase = phases.system_modification
def run(self, info):
from common.tools import sed_i
inittab_path = os.path.join(info.root, 'etc/inittab')
tty1 = '1:2345:respawn:/sbin/getty 38400 tty1'
2013-08-17 17:28:46 +02:00
sed_i(inittab_path, '^' + tty1, '#' + tty1)
ttyx = ':23:respawn:/sbin/getty 38400 tty'
for i in range(2, 7):
i = str(i)
2013-08-17 17:28:46 +02:00
sed_i(inittab_path, '^' + i + ttyx + i, '#' + i + ttyx + i)