From 98475b07489f57e74c8b6d0d03c4966b1fef1b0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ladislav=20Slez=C3=A1k?= Date: Wed, 19 Jun 2024 15:45:09 +0200 Subject: [PATCH] fix(Live): Fixed console messages displayed twice --- .../system/agama-certificate-wait.service | 27 +++++++++++++++++++ live/root/usr/bin/agama-issue-generator | 10 +++++++ live/src/config.sh | 1 + 3 files changed, 38 insertions(+) create mode 100644 live/root/etc/systemd/system/agama-certificate-wait.service diff --git a/live/root/etc/systemd/system/agama-certificate-wait.service b/live/root/etc/systemd/system/agama-certificate-wait.service new file mode 100644 index 0000000000..7eddd03474 --- /dev/null +++ b/live/root/etc/systemd/system/agama-certificate-wait.service @@ -0,0 +1,27 @@ +[Unit] +Description=Postpone login prompt after the SSL fingerprint issue is generated + +After=agama-web-server.service + +# copied from YaST2-Second-Stage.service +Before=getty@tty1.service +Before=getty@tty2.service +Before=getty@tty3.service +Before=getty@tty4.service +Before=getty@tty5.service +Before=getty@tty6.service +Before=serial-getty@hvc0.service +Before=serial-getty@sclp_line0.service +Before=serial-getty@ttyAMA0.service +Before=serial-getty@ttyS0.service +Before=serial-getty@ttyS1.service +Before=serial-getty@ttyS2.service +Before=serial-getty@ttysclp0.service + +[Service] +Type=oneshot +# wait at most 15 seconds to not block +ExecStart=agama-issue-generator --wait-for-ssl 15 + +[Install] +WantedBy=default.target diff --git a/live/root/usr/bin/agama-issue-generator b/live/root/usr/bin/agama-issue-generator index 107b47de58..0f4b8dc357 100755 --- a/live/root/usr/bin/agama-issue-generator +++ b/live/root/usr/bin/agama-issue-generator @@ -149,6 +149,14 @@ generate_network_url() { fi } +# wait until the SSL fingreprint issue is create, but at most 10 seconds +wait_for_ssl_issue() { + for i in $(seq 1 "$1"); do + [ -f "$CERT_ISSUE" ] && exit 0 + sleep 1 + done +} + # make sure the parent directory for the issues exists mkdir -p /run/issue.d @@ -159,6 +167,8 @@ elif [ "$1" = "--ssh" ]; then generate_ssh_fingerprints elif [ "$1" = "--ssl" ]; then generate_certificate_fingerprints +elif [ "$1" = "--wait-for-ssl" ]; then + wait_for_ssl_issue "$2" elif [ "$1" = "--network" ]; then generate_network_url "$2" "$3" elif [ "$1" = "--watch-avahi" ]; then diff --git a/live/src/config.sh b/live/src/config.sh index 69ff8b0d06..4286912cf7 100644 --- a/live/src/config.sh +++ b/live/src/config.sh @@ -29,6 +29,7 @@ systemctl enable agama-auto.service systemctl enable agama-hostname.service systemctl enable agama-proxy-setup.service systemctl enable agama-certificate-issue.path +systemctl enable agama-certificate-wait.service systemctl enable agama-welcome-issue.service systemctl enable agama-avahi-issue.service systemctl enable agama-ssh-issue.service