2014-04-07 14:23:24 +02:00
|
|
|
from bootstrapvz.base import Task
|
|
|
|
from bootstrapvz.common import phases
|
2014-12-31 14:14:43 +01:00
|
|
|
from bootstrapvz.common.tasks import grub
|
2015-06-29 18:00:21 +02:00
|
|
|
from bootstrapvz.common.tasks import kernel
|
|
|
|
import os
|
|
|
|
|
|
|
|
|
|
|
|
class PatchUdev(Task):
|
|
|
|
description = 'Patching udev configuration to remove ROOTDELAY sleep'
|
|
|
|
phase = phases.system_modification
|
|
|
|
successors = [kernel.UpdateInitramfs]
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def run(cls, info):
|
|
|
|
from bootstrapvz.common.tools import log_check_call
|
|
|
|
from . import assets
|
|
|
|
# c.f. http://anonscm.debian.org/cgit/pkg-systemd/systemd.git/commit/?id=61e055638cea
|
2015-07-29 19:05:03 +00:00
|
|
|
diff_file = file.read(open(os.path.join(assets, 'udev.diff'), 'r'))
|
|
|
|
udev_dir = os.path.join(info.root, 'usr/share/initramfs-tools/scripts/init-top')
|
|
|
|
log_check_call(['patch', '--no-backup-if-mismatch', '-p6', '-d' + udev_dir], stdin=diff_file)
|
2014-04-07 14:23:24 +02:00
|
|
|
|
2014-04-08 23:29:45 +02:00
|
|
|
|
2014-04-07 14:23:24 +02:00
|
|
|
class ConfigureGrub(Task):
|
|
|
|
description = 'Change grub configuration to allow for ttyS0 output'
|
|
|
|
phase = phases.system_modification
|
2015-08-05 22:16:24 +00:00
|
|
|
predecessors = [grub.ConfigureGrub]
|
2014-12-31 14:14:43 +01:00
|
|
|
successors = [grub.InstallGrub_1_99, grub.InstallGrub_2]
|
2014-04-07 14:23:24 +02:00
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def run(cls, info):
|
|
|
|
from bootstrapvz.common.tools import sed_i
|
|
|
|
grub_config = os.path.join(info.root, 'etc/default/grub')
|
2015-08-05 22:16:24 +00:00
|
|
|
sed_i(grub_config, r'^(GRUB_CMDLINE_LINUX_DEFAULT=.*)', r'GRUB_CMDLINE_LINUX_DEFAULT=""')
|
2015-07-29 19:18:04 +00:00
|
|
|
sed_i(grub_config, r'^(GRUB_CMDLINE_LINUX*=".*)"\s*$', r'\1console=tty0 console=ttyS0,115200n8 earlyprintk=ttyS0,115200 rootdelay=300"')
|
2015-08-06 00:21:23 +00:00
|
|
|
sed_i(grub_config, r'^(GRUB_HIDDEN_TIMEOUT=).*', r'#GRUB_HIDDEN_TIMEOUT=true')
|
2015-07-29 19:18:04 +00:00
|
|
|
sed_i(grub_config, r'^.*(GRUB_TIMEOUT=).*$', r'GRUB_TIMEOUT=5')
|