]> git.madduck.net Git - code/vinst.git/blobdiff - preseed/jessie/commands/late_commands.d/enable_serial_console

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

improve post-setup serial console setup
[code/vinst.git] / preseed / jessie / commands / late_commands.d / enable_serial_console
index 09f8acb8c689e8bee8b9ae1042a4d1388e422623..47768c0b2cdee7827957fd636abbdf482ea76971 100755 (executable)
@@ -1,9 +1,15 @@
 #!/bin/sh
 echo "Enabling the serial console..."
-#683124 requires the cmdline patch, and #444026 is for GRUB_TERMINAL:
-sed -i -e '/^GRUB_CMDLINE_LINUX=/s/"$/ console=tty0 console=ttyS0,115200n8&/' \
-       -e '/^GRUB_CMDLINE_LINUX=/s/=" /="/' \
-       -e '/^GRUB_TERMINAL=/s/serial/"& console"/' \
-       /etc/default/grub
-update-grub
-sed -i '/ttyS0/s/^#//;/ttyS0/s/9600 vt100/115200 linux/' /etc/inittab
+if [ -f /etc/default/grub ]; then
+  #683124/#769406 requires the cmdline patch, and #444026 is for GRUB_TERMINAL:
+  sed -i -e '/^GRUB_CMDLINE_LINUX=/s/"$/ console=tty0 console=ttyS0,115200n8&/' \
+        -e '/^GRUB_CMDLINE_LINUX=/s/=" /="/' \
+        -e '/^GRUB_TERMINAL=/s/serial/"& console"/' \
+        /etc/default/grub
+  update-grub
+fi
+if [ -f /etc/inittab ]; then
+  sed -i '/ttyS0/s/^#//;/ttyS0/s/9600 vt100/115200 linux/' /etc/inittab
+else
+  echo "Not setting up a TTY on the serial port, presumably systemd will..."
+fi