I'm creating a installer ISO for a CentOS 7 based appliance, and I am having issues with getting user input to work properly during the %post section.
I found this thread which seems to report the same behaviour - viewtopic.php?f=47&t=63280&p=266565.
The rest of my %post script works (to install various repos and call APIs, etc), but I want the user to be prompted to enter some details:
Here's the first part of our %post section:
Code: Select all
%post --logfile=/root/ks-post.log
set -x
exec < /dev/tty2 > /dev/tty2
chvt 2
echo "################################"
echo "# Running Post Configuration #"
echo "################################"
hostname=""
vpn=""
while [[ "$HOSTNAME" == "" ]] || [[ "$vpn" == "" ]] ; do
echo
echo " *** Please enter the following details: *** "
echo
read -p "Hostname: " hostname
read -p "VPN Provisioning ID: " vpn
done
I am assuming it was a problem using tty2, however I've tried changing this to various ttys between 1-5 and I experience the same behaviour.
For setting hostname I can get away with using the built-in GUI, but I would really like to be able to specify some other details (API keys, etc) during install.
Does anyone have a working example of user input during %post? Or is there documentation around which tty should be used to accept user input?
Cheers.