From a9eb28e33346f36eafc49d0a1212fa419db57a08 Mon Sep 17 00:00:00 2001
From: Vladimir Still <git@vstill.eu>
Date: Wed, 4 Sep 2019 12:37:17 +0200
Subject: [PATCH] debootstrap: Make serial speed parametrized

---
 debootstrap-stage2 | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/debootstrap-stage2 b/debootstrap-stage2
index 96a3cbe..50f69cd 100644
--- a/debootstrap-stage2
+++ b/debootstrap-stage2
@@ -1,5 +1,8 @@
 set -ex
 
+SERIAL_SPEED=9600
+grep -q pontos /etc/hostname && SERIAL_SPEED=115200
+
 export LANG=C.UTF-8
 
 cat > /etc/apt/sources.list <<EOF
@@ -42,13 +45,13 @@ else
 	apt install -yy grub-pc
 fi
 if ! grep -q 'console serial' /etc/default/grub; then
-    sed -i /etc/default/grub -e 's/GRUB_CMDLINE_LINUX_DEFAULT="quiet"/GRUB_CMDLINE_LINUX_DEFAULT="quiet console=tty0 console=ttyS1,9600n8"/'
+    sed -i /etc/default/grub -e "s/GRUB_CMDLINE_LINUX_DEFAULT=\"quiet\"/GRUB_CMDLINE_LINUX_DEFAULT=\"quiet console=tty0 console=ttyS1,$SERIAL_SPEED\"/"
     cat >> /etc/default/grub <<EOF
 # Preload both GPT and MBR modules so that they are not missed
 GRUB_PRELOAD_MODULES="part_gpt part_msdos lvm"
 
 ## Serial console
-GRUB_SERIAL_COMMAND="serial --speed=9600 --unit=1"
+GRUB_SERIAL_COMMAND="serial --speed=$SERIAL_SPEED --unit=1"
 
 # Uncomment to use basic console
 GRUB_TERMINAL_INPUT="console serial"
-- 
GitLab