Add autoselected consoles to Grub config

Prevents having to pick a bunch, which can break if more than one serial
is present for example. Also automates this based on what the installer
has/detects as active.
This commit is contained in:
Joshua Boniface 2021-12-13 02:18:55 -05:00
parent d015489a83
commit a3fd110b59
2 changed files with 18 additions and 1 deletions

View File

@ -58,6 +58,12 @@ target_keys_path="keys.txt"
# Deploy username (usually deploy)
target_deploy_user="deploy"
# Consoles to use by the inital boot process; these are normally set automatically
# based on the TTYs found by the installer, and are later overridden by the Ansible
# playbooks based on the hardware configuration. It is best to leave this commented
# unless you know that you need it.
#target_consoles="console=tty1 console=ttyS1,115200"
# Installer checkin URI (provided by pvcbootstrapd)
#pvcbootstrapd_checkin_uri="http://10.199.199.254:9999/checkin/installer"
pvcbootstrapd_checkin_uri="{pvcbootstrapd_checkin_uri}"

View File

@ -49,6 +49,17 @@ fi
printf "PID $$ on TTY ${this_tty}" > ${lockfile}
echo
# Set the target consoles in the installed image
target_consoles=""
for tty in $( echo -e "$( sed 's/ /\n/g' <<<"${active_ttys[@]}" )" | sort ); do
tty_type=${tty%%[0-9]*}
# Only use the first of each console type
if grep -q "${tty_type}" <<<"${target_consoles}"; then
continue
fi
target_consoles="${target_consoles} console=${tty}"
done
iso_name="XXDATEXX"
target_deploy_user="XXDEPLOYUSERXX"
@ -851,7 +862,7 @@ cat <<EOF | tee ${target}/etc/default/grub >&2
GRUB_DEFAULT=0
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="Parallel Virtual Cluster (PVC) - Debian"
GRUB_CMDLINE_LINUX="console=hvc0 console=tty0 console=tty1 console=ttyS0,115200 console=ttyS1,115200"
GRUB_CMDLINE_LINUX="${target_consoles}"
GRUB_TERMINAL_INPUT="console serial"
GRUB_TERMINAL_OUTPUT="gfxterm serial"
GRUB_SERIAL_COMMAND="serial --unit=0 --unit=1 --speed=115200"