I am doing some server provisioning and I need to run a script AFTER installation as it requires the system to be fully functional, include services. So I cannot put it inside the %post
section of my kickstart file.
Instead I have created a systemd service which disables itself as the last thing it does.
[Unit]
Description=Prepare the system after installation
[Service]
Type=oneshot
ExecStart=/usr/bin/prepare-system
[Install]
WantedBy=multi-user.target
The problem is that during the first boot, I get to the login prompt and can even login and start using the system, while the "first boot script" is still running.
This gives the Administrator setting up the system the illusion that the system is finished, when it's really not.
I would instead want the service to delay the booting, preferably showing a message like "The system is being prepared, please wait..." and wait there until the script is finished.
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: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.