Wait for systemd oneshot service to finish

Found the answer here: https://unix.stackexchange.com/questions/216045/systemd-configure-unit-file-so-that-login-screen-is-not-shown-until-service-exi

Just set Before to when the terminal is available:

[Unit]
Description=Prepare the system after installation
[email protected] [email protected] [email protected] [email protected] [email protected] [email protected]

[Service]
Type=oneshot
ExecStart=/usr/bin/prepare-system

[Install]
WantedBy=multi-user.target

Assuming you use GDM as your login manager, add a line with Before=gdm.service in the [Unit] section.

If you don't use gdm, find out which service starts xorg and put that in the Before= line.

This will cause the task to complete before the login manager displays.