Chef recipe for interactive install

chef

I'm new to chef and trying to set up an Ubuntu VM for testing by installing our product automatically. I am able to download the .tgz, extract it and execute the installer using a bash resource.

I the problem I've encountered is that our install script enforces a EULA check for the command line install. It has something similar to the following in a shell script:

# various statements and input to expect from stdin
echo "You must accept our EULA to install the software"

read ENTER
more EULA.txt

echo "Do you accept the EULA?"
# additional input expected from stdin

I can easily add the expected input from standard by using a response file and kicking off the install with ./install.sh < response.txt, but this stops working once more is executed. The more command doesn't see the input from the response file and still expects a 'q' to quit the command before accepting the eula.

What is the proper way to execute such an install automatically using chef? Beyond simply re-writing the install.sh script to ignore the EULA line.

Best Answer

Also redirect the output somewhere. more will simply display the entire file without pausing and then exit if standard output is not a terminal.

For example:

 ./install.sh < response.txt | cat

Though you really should be using something like expect for scenarios like this.