gbmc-release-24.1.x: revert "bare-metal: restrict host console to read-only mode"

This reverts commit 7626062fdb78e985057179c7d0701373c3be203b.

Tested: N/A
Google-Bug-Id: 232191934
Change-Id: I2108637b8dbd7c0d728f0da84b8e9ac137e15ba0
Signed-off-by: Willy Tu <wltu@google.com>
diff --git a/recipes-google/bare-metal-setup/bare-metal-setup.bb b/recipes-google/bare-metal-setup/bare-metal-setup.bb
index 1789bfc..8e56bb8 100644
--- a/recipes-google/bare-metal-setup/bare-metal-setup.bb
+++ b/recipes-google/bare-metal-setup/bare-metal-setup.bb
@@ -26,7 +26,6 @@
 GPIO_CHIP ?= "0"
 GPIO_LINE ?= "0"
 ENABLE_BM_FILE ?= "/var/google/config-package/enable-bm.flag"
-ENABLE_CONSOLE_FILE ?= "/var/google/config-package/enable-bm-console.flag"
 BMREADY_FILE ?= "/run/bm-ready.flag"
 
 do_install:append() {
@@ -36,7 +35,6 @@
         -e "s#@GPIO_CHIP@#${GPIO_CHIP}#" \
         -e "s#@GPIO_LINE@#${GPIO_LINE}#" \
         -e "s#@ENABLE_BM_FILE@#${ENABLE_BM_FILE}#" \
-        -e "s#@ENABLE_CONSOLE_FILE@#${ENABLE_CONSOLE_FILE}#" \
         -e "s#@BMREADY_FILE@#${BMREADY_FILE}#" \
         >bare-metal-setup.sh
 
diff --git a/recipes-google/bare-metal-setup/files/bare-metal-setup.sh.in b/recipes-google/bare-metal-setup/files/bare-metal-setup.sh.in
index 8c31d24..4e3b76d 100644
--- a/recipes-google/bare-metal-setup/files/bare-metal-setup.sh.in
+++ b/recipes-google/bare-metal-setup/files/bare-metal-setup.sh.in
@@ -6,48 +6,8 @@
 GPIO_CHIP="@GPIO_CHIP@"
 GPIO_LINE="@GPIO_LINE@"
 ENABLE_BM_FILE="@ENABLE_BM_FILE@"
-ENABLE_CONSOLE_FILE="@ENABLE_CONSOLE_FILE@"
 BMREADY_FILE="@BMREADY_FILE@"
 
-READ_ONLY_CONSOLE_FLAG="/run/readonly-console.flag"
-
-function override_obmc_console_in_bm_mode() {
-   host_console_client_service="serial-to-host@.service"
-   bmc_console_client_service="serial-to-bmc@.service"
-
-   systemd_runtime_dir='/run/systemd/system'
-
-   host_console_client_dir="${systemd_runtime_dir}/${host_console_client_service}.d"
-   bmc_console_client_dir="${systemd_runtime_dir}/${bmc_console_client_service}.d"
-
-   touch "${READ_ONLY_CONSOLE_FLAG}"
-
-   mkdir -p "${host_console_client_dir}" "${bmc_console_client_dir}"
-
-   echo "[Unit]
-ConditionPathExists=${READ_ONLY_CONSOLE_FLAG}
-[Service]
-RestartPreventExitStatus=
-RestartPreventExitStatus=SIGINT SIGQUIT SIGTSTP
-SuccessExitStatus=
-SuccessExitStatus=SIGINT SIGQUIT SIGTSTP
-ExecStart=
-ExecStart=-/sbin/agetty -8 -n -l /usr/libexec/readonly-obmc-console-client -i -N -R -L %I 115200 xterm
-ExecStopPost=
-ExecStopPost=-/bin/sh -c 'systemctl start --no-block serial-to-bmc@%i'
-" > "${host_console_client_dir}/50-bm-override.conf"
-
-   echo "[Service]
-ExecStopPost=
-ExecStopPost=/bin/bash -c \"if [ -f ${READ_ONLY_CONSOLE_FLAG} ]; then \
-    systemctl start --no-block serial-to-host@%i; \
-else \
-    systemctl start --no-block serial-to-bmc@%i; \
-fi\"
-" > "${bmc_console_client_dir}/50-bm-override.conf"
-
-}
-
 function hide_boot_drive_in_bm_mode() {
     # In Bare Metal mode, power off the boot drive
     if [[ "$BM_MODE" -eq "1" || -f "$ENABLE_BM_FILE" ]]; then
@@ -60,12 +20,6 @@
         echo "Successfully set the GPIO to hide cSSD/cnSSD creating ${BMREADY_FILE}"
         # Disable usb network
         ln -s /dev/null /run/systemd/system/google-usb-dynamic.service 2> /dev/null
-        # Change the host console to read only, unless we require to keep the
-        # console
-        if [[ ! -f "$ENABLE_CONSOLE_FILE" ]]; then
-            override_obmc_console_in_bm_mode
-        fi
-
         systemctl daemon-reload
         touch "${BMREADY_FILE}"
     else