Skip to content

Commit

Permalink
installer: reorder the patch operation for tty service
Browse files Browse the repository at this point in the history
    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 <vicente.cheng@suse.com>
  • Loading branch information
Vicente-Cheng authored and bk201 committed Nov 24, 2023
1 parent 3abd2f4 commit 35dad50
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
3 changes: 1 addition & 2 deletions package/harvester-os/files/system/oem/91_installer.yaml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
14 changes: 9 additions & 5 deletions package/harvester-os/files/usr/bin/setup-installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

0 comments on commit 35dad50

Please sign in to comment.