6

I'm using the following kickstart post installation logging options:

%post  
exec < /dev/tty3 > /dev/tty3  
chvt 3  
echo  
echo "################################"  
echo "# Running Post Configuration #"  
echo "################################"  
(  
  echo 'Hello, World!'  
  cat > test_file <<EOF  
  Hello World  
  EOF  
) 2>&1 | /usr/bin/tee /var/log/post_install.log  
chvt 1  

The problem is that I'm not actually capturing commands used to create the test_file (code beginning with cat and ending with EOF) in my log file. The echo statement is there but nothing more.

The following code solves the problem but will mean I have to append a tee statement to all of my post installation procedures, which is not satisfactory.

echo -e "# Writing test_file and capturing to log_file" && /usr/bin/tee -ai log_file >> test_file << EOF  
Hello World  
EOF  

The current log file created only captures echo statement which is not enough. I want to capture the commands executed complete with their associated options and arguments.

Scott Pack
  • 14,717
  • 10
  • 51
  • 83
3laz3r
  • 63
  • 1
  • 1
  • 4

1 Answers1

7

Post can automatically log:

%post --log=/root/kickstart-post.log

And running

set -x
should log all executed commands and arguments.
HampusLi
  • 3,398
  • 15
  • 14