Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions initial-setup.spec
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Requires: anaconda-tui >= %{anacondaver}
Requires: libxkbcommon
Requires: python3-simpleline >= 1.4
Requires: systemd >= 235
Requires: kmscon >= 10.1
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
Expand Down
18 changes: 14 additions & 4 deletions initial_setup/tui/tui.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class MultipleTTYHandler(object):
the Initial Setup stdin.
"""

def __init__(self, tui_stdout_fd, tui_stdin_fd):
def __init__(self, tui_stdout_fd, tui_stdin_fd, console):
# create file objects for the TUI stdout and stdin fds
self._tui_stdout_fd = tui_stdout_fd
self._tui_stdout = os.fdopen(tui_stdout_fd, "r")
Expand All @@ -43,6 +43,8 @@ def __init__(self, tui_stdout_fd, tui_stdin_fd):
self._active_console_in = None
self._active_console_out = None

self._origin_console = console

self._console_read_fos = {}
self._console_write_fos = []
self._open_all_consoles()
Expand All @@ -55,10 +57,12 @@ def _open_all_consoles(self):
"""Open all consoles suitable for running the Initial Setup TUI."""
console_write_fos = {}
console_read_fos = {}
console_paths = (os.path.join("/dev", c) for c in list_usable_consoles_for_tui())
console_paths = [os.path.join("/dev", c) for c in list_usable_consoles_for_tui()]
if self._origin_console:
console_paths.append(self._origin_console)
usable_console_paths = []
unusable_console_paths = []
for console_path in console_paths:
for console_path in set(console_paths):
try:
write_fo = open(console_path, "w")
read_fo = open(console_path, "r")
Expand Down Expand Up @@ -268,6 +272,11 @@ def __init__(self, cli_args):
# start the multi TTY handler and just run in the single
# local console.
if self._use_multi_tty_handler:
# save current console
current_console = None
if os.isatty(sys.stdout.fileno()):
current_console = os.ttyname(sys.stdout.fileno())

# redirect stdin and stdout to custom pipes

# stdin
Expand All @@ -281,7 +290,8 @@ def __init__(self, cli_args):

# instantiate and start the multi TTY handler
self.multi_tty_handler = MultipleTTYHandler(tui_stdin_fd=tui_stdin_fd,
tui_stdout_fd=tui_stdout_fd)
tui_stdout_fd=tui_stdout_fd,
console=current_console)
# start the multi-tty handler
thread_manager.add_thread(
name="initial_setup_multi_tty_thread",
Expand Down
9 changes: 3 additions & 6 deletions systemd/initial-setup.service
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,10 @@ ConditionKernelCommandLine=!rd.live.image
Type=oneshot
TimeoutSec=0
RemainAfterExit=yes
# tell systemd to stop logging to the console, to prevent it's messages
# with interfering with the Initial Setup TUI potentially running there
ExecStartPre=/bin/kill -SIGRTMIN+21 1
ExecStartPre=-/bin/plymouth quit
ExecStart=/usr/libexec/initial-setup/run-initial-setup
# re-enable systemd console logging once Initial Setup is done
ExecStartPost=/bin/kill -SIGRTMIN+20 1
ExecStart=/usr/bin/kmscon --vt 7 --no-issue --oneshot --login /usr/libexec/initial-setup/run-initial-setup
# Return to tty 1
ExecStartPost=chvt 1
TimeoutSec=0
RemainAfterExit=no

Expand Down