2013-08-10 16:18:48 +02:00
|
|
|
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)
|
2013-08-10 16:18:48 +02:00
|
|
|
ttyx = ':23:respawn:/sbin/getty 38400 tty'
|
2013-11-21 16:46:27 +01:00
|
|
|
for i in range(2, 7):
|
2013-08-10 16:18:48 +02:00
|
|
|
i = str(i)
|
2013-08-17 17:28:46 +02:00
|
|
|
sed_i(inittab_path, '^' + i + ttyx + i, '#' + i + ttyx + i)
|