[Vmdebootstrap-devel] [PATCH 1/4] grub2: only configure console if serial-console is set

Jan Gerber j at mailb.org
Thu Apr 9 10:00:12 UTC 2015


---
 vmdebootstrap | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/vmdebootstrap b/vmdebootstrap
index a9127ae..eab5832 100755
--- a/vmdebootstrap
+++ b/vmdebootstrap
@@ -607,17 +607,17 @@ class VmDebootstrap(cliapp.Application):  # pylint: disable=too-many-public-meth
                      '%s' % os.path.join(rootdir, 'proc')])
         self.runcmd(['mount', '/sys', '-t', 'sysfs', '-obind',
                      '%s' % os.path.join(rootdir, 'sys')])
-
-        cmdline = 'GRUB_CMDLINE_LINUX_DEFAULT="console=tty0 console=tty1 console=ttyS0,38400n8"'
-        terminal = 'GRUB_TERMINAL="serial gfxterm"'
-        command = 'GRUB_SERIAL_COMMAND="serial --speed=38400 --unit=0 --parity=no --stop=1"'
-        grub_cfg = os.path.join(rootdir, 'etc', 'default', 'grub')
-        logging.debug("Allowing serial output in grub config %s", grub_cfg)
-        with open(grub_cfg, 'a+') as cfg:
-            cfg.write("# %s serial support\n" % os.path.basename(__file__))
-            cfg.write("%s\n" % cmdline)
-            cfg.write("%s\n" % terminal)
-            cfg.write("%s\n" % command)
+        if self.settings['serial-console']:
+            cmdline = 'GRUB_CMDLINE_LINUX_DEFAULT="console=tty0 console=tty1 console=ttyS0,38400n8"'
+            terminal = 'GRUB_TERMINAL="serial gfxterm"'
+            command = 'GRUB_SERIAL_COMMAND="serial --speed=38400 --unit=0 --parity=no --stop=1"'
+            grub_cfg = os.path.join(rootdir, 'etc', 'default', 'grub')
+            logging.debug("Allowing serial output in grub config %s", grub_cfg)
+            with open(grub_cfg, 'a+') as cfg:
+                cfg.write("# %s serial support\n" % os.path.basename(__file__))
+                cfg.write("%s\n" % cmdline)
+                cfg.write("%s\n" % terminal)
+                cfg.write("%s\n" % command)
         try:
             self.runcmd(['chroot', rootdir, 'update-grub'])
             self.runcmd(['chroot', rootdir, 'grub-install', install_dev])
-- 
2.1.4




More information about the Vmdebootstrap-devel mailing list