]> git.siccegge.de Git - forks/vmdebootstrap.git/commitdiff
Allow custom command to handle the serial console
authorAntonio Terceiro <antonio.terceiro@linaro.org>
Tue, 11 Jun 2013 14:44:02 +0000 (11:44 -0300)
committerLars Wirzenius <liw@liw.fi>
Sun, 14 Jul 2013 16:03:28 +0000 (17:03 +0100)
The need I am addressing with this is making the serial console
auto-login as root. For this right now I'm using the auto-serial-console
program from the linaro-overlay package:

https://launchpad.net/~linaro-maintainers/+archive/overlay/+files/linaro-overlay_1112.2.dsc

In the near future I plan to port the generic parts of that package to
Debian under the name auto-serial-console or some similar

vmdebootstrap

index ea5edff6784ddacc49ba8a54e171f67c5b49450e..f857baca51ea989a09f4a0cd17114173e5d624f1 100755 (executable)
@@ -73,6 +73,11 @@ class VmDebootstrap(cliapp.Application):
                                   metavar='USER/PASSWORD')
         self.settings.boolean(['serial-console'], 
                               'configure image to use a serial console')
+        self.settings.string(['serial-console-command'],
+                             'command to manage the serial console, appended '
+                               'to /etc/inittab (%default)',
+                             metavar='COMMAND',
+                             default='/sbin/getty -L ttyS0 115200 vt100')
         self.settings.boolean(['sudo'], 
                               'install sudo, and if user is created, add them '
                                 'to sudo group')
@@ -345,10 +350,11 @@ append initrd=%(initrd)s root=UUID=%(uuid)s ro %(kserial)s
         f.close()
         
         if self.settings['serial-console']:
+            serial_command = self.settings['serial-console-command']
             logging.debug('adding getty to serial console')
             inittab = os.path.join(rootdir, 'etc/inittab')
             with open(inittab, 'a') as f:
-                f.write('\nS0:23:respawn:/sbin/getty -L ttyS0 115200 vt100\n')
+                f.write('\nS0:23:respawn:%s\n' % serial_command)
 
         self.runcmd(['extlinux', '--install', rootdir])
         self.runcmd(['sync'])