Chef recipe for interactive install

Jay Lindquist asked:

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 ./ < 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 script to ignore the EULA line.

My 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:

 ./ < response.txt | cat

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

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.