By "initial setup", I meant during the initial install of the operating system, starting from "net-install". Maybe one user is defined. The reboot command is issued from a script that was initiated by hand.
So you want it to run as the final part of the install process??
If that's the case, then you should create a kickstart file with the post installation script in it:
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/htm...
If you want/need it to run the script after the install has completed and the first reboot, then you need to look at the FirstBoot scripts
https://access.redhat.com/solutions/2028143
P.