1

I have a kickstart file that I use to install CentOS 7. I run some scripts in the %post section of the kickstart file. In the script, there is a checking for the compatibility of the machine, and if the checking fails, I need to reboot/shutdown that particular machine, without completing the installation. But when I install the OS, If the compatibility checking fails, the computer is not rebooting, instead it is showing a message "running in chroot, ignoring requst".

How can i do this? I want to reboot my machine if the compatibility check fails, I am running the scripts in the %post section of the kickstart file.

Vishnu
  • 711
  • 2
  • 8
  • 15
  • You know that in %post, the system is already installed! – Michael Hampton May 17 '16 at 10:21
  • I have some packages that will be installed after the OS installation. I want to stop the installation of the software if the system doesn't meet the requirements. – Vishnu May 17 '16 at 10:47

1 Answers1

1

Have a look at %pre -- maybe you can run your tests prior to the installation. Otherwise you can have multiple %post sections. And there's also a %post --nochroot which does exactly what you think it does.

I would do the following if I had to do it with %post and needed the chroot for the test:

%post
/path/to/test || touch /test-failed
%end

%post --nochroot
test -e /mnt/sysimage/test-failed && reboot
%end
Andreas Rogge
  • 2,853
  • 11
  • 24