From 5533c467549dece1729d7d152d7c5c8ebdb13974 Mon Sep 17 00:00:00 2001 From: Vicente Cheng Date: Wed, 1 Nov 2023 21:50:57 +0800 Subject: [PATCH] installer: reorder the patch operation for tty service We need guarantee the boot order like following: - `Patched tty service` -> `start tty service` So try to move the patch operation to the initramfs stage Signed-off-by: Vicente Cheng --- .../files/system/oem/91_installer.yaml | 3 +-- .../harvester-os/files/usr/bin/setup-installer.sh | 14 +++++++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/package/harvester-os/files/system/oem/91_installer.yaml b/package/harvester-os/files/system/oem/91_installer.yaml index 7a929108c..9e946d5a1 100644 --- a/package/harvester-os/files/system/oem/91_installer.yaml +++ b/package/harvester-os/files/system/oem/91_installer.yaml @@ -1,11 +1,10 @@ name: "Setup installer" stages: - boot: + initramfs: - commands: - setup-installer.sh # reference: https://github.com/harvester/harvester/issues/2663, thanks @Ernad's enhancement if: '! grep -q "harvester.installer.disable=true" /proc/cmdline' - initramfs: - environment_file: "/etc/rancher/installer/env" environment: HARVESTER_DASHBOARD: "true" diff --git a/package/harvester-os/files/usr/bin/setup-installer.sh b/package/harvester-os/files/usr/bin/setup-installer.sh index b7f0dee10..bcb2fa8a2 100755 --- a/package/harvester-os/files/usr/bin/setup-installer.sh +++ b/package/harvester-os/files/usr/bin/setup-installer.sh @@ -37,13 +37,20 @@ EOF } +echo "Remove the getty service..." +rm -rf "/etc/systemd/system/getty*" + +echo "Remove the serial-getty service..." +rm -rf "/etc/systemd/system/serial-getty*" + # reverse the ttys to start from the last one for TTY in $(cat /sys/class/tty/console/active); do tty_num=${TTY#tty} # tty1 ~ tty64 if [[ $tty_num =~ ^[0-9]+$ ]]; then - create_drop_in "/run/systemd/system/getty@${TTY}.service.d" + create_drop_in "/etc/systemd/system/getty@${TTY}.service.d" + break fi @@ -55,9 +62,6 @@ for TTY in $(cat /sys/class/tty/console/active); do continue fi - create_drop_in "/run/systemd/system/serial-getty@${TTY}.service.d" + create_drop_in "/etc/systemd/system/serial-getty@${TTY}.service.d" break done - - -systemctl daemon-reload