0

I couldn't figure out exactly how to word this in my searching; if someone could tell me what this is called and point me to a resource I would greatly appreciate it.

TL;DR: For a CentOS installation, I want users to be able to watch the %post section of the kickstart file operate on the physical screen so it can be monitored. A person will hit enter on a keyboard to kick off an installation, and the same person will watch the install work on a monitor in front of them. I want them to see what it's doing.

My understanding of the structure is this:

  • The CentOS installation reads a kickstart file.

  • The %pre section of the kickstart runs in the "root" context of the installer live image.

  • The %post section runs in the "root" context of the installing system, allowing me to perform things like "yum -y update" etc to affect the installed system.

In a normal environment, I know I can redirect the output of a command to a terminal with:

cat "file.txt" > /dev/tty3

The problem is that this command redirects output to the chroot jail's version of /dev/tty3, which does not show on the install screen. I want it to output directly to the "parent" installation's screen, so if it somehow recognized the parent directory, it would be something like

cat "file.txt" > ../../../dev/tty3

Or something.

Can anyone help?

Locane
  • 429
  • 1
  • 8
  • 20
  • For clarity, is this for monitoring when connected to the console (ie a human sitting there in realtime) or something more automated. If it's a human at the console then doesn't the virtual console show the messages you want (`ALT-F3`)? – Paul Haldane Apr 27 '17 at 07:58
  • It's for a human to look at the physical screen, or an IPMI window which are equivalent for this scenario. I'll alter the original question, thanks! – Locane Apr 27 '17 at 19:16

1 Answers1

0

It turns out I'm actually just a moron. Terminal redirection in %post works just fine; although I don't understand why.

Here is the relevant section of my kickstart; the problem was that I was redirecting output of each command with ">>" and forgot that it does not display to screen; you need to use "|tee -a" for that. I was so caught up in terminal redirection logic that I missed the obvious error.

The following works in a CentOS 7.3 kickstart file for doing what I wanted:

%post --interpreter /bin/bash --log=/root/post_section.log
#Take note of our current tty
c=`tty`
#Set the file descriptors of our shell to the input and output of
#tty 6
exec < /dev/tty6 > /dev/tty6
#Change the visible terminal to terminal 6
chvt 6
#Clear the screen on TTY6
clear

#Do DevOps shit
yum -y install python epel-release python-pip git
echo ""
echo "Cloning deploy_devops..."
cd /root
git clone http://<REMOVED>devops.git
cd deploy-devops
echo "Kicking off deploy_devops.py..."
time python devops.py
echo "All done."

#Change the visible terminal back to #1
chvt 1
#Put our file descriptors back to the original terminal
exec < $c > $c
%end
Locane
  • 429
  • 1
  • 8
  • 20