Implemented DisableGetTTYs

This commit is contained in:
Anders Ingemann 2013-07-01 23:33:59 +02:00
parent 8bbf1b3fec
commit 953e324ca3
2 changed files with 17 additions and 1 deletions

View file

@ -42,7 +42,8 @@ def tasks(tasklist, manifest):
apt.AptUpgrade(),
boot.ConfigureGrub(),
boot.ModifyFstab(),
boot.BlackListModules())
boot.BlackListModules(),
boot.DisableGetTTYs())
from common.tasks import TriggerRollback
tasklist.add(TriggerRollback())

View file

@ -60,3 +60,18 @@ class BlackListModules(Task):
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'))
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'
sed_i(inittab_path, '^'+tty1, '#'+tty1)
ttyx = ':23:respawn:/sbin/getty 38400 tty'
for i in range(2, 6):
i = str(i)
sed_i(inittab_path, '^'+i+ttyx+i, '#'+i+ttyx+i)