I’m working on a script to automatically install phoronix test suite. The actual install goes smoothly, but the program requires php. It will be run on either RHEL or SUSE, meaning I have to have a case for each one (one for yum and the other for zypper). My problem comes in with using expect– I can’t get it to properly interact with the respective installers. Does anyone have pointers for what I’m doing incorrectly, syntax-wise or other? Much appreciated.
Side note-if there’s a way to do this with python, that would be amazing to hear about.
spawn ./wgetphoronix.py
expect {"Phoronix install finished. RHEL OS." {spawn yum install php \
expect "Nothing to do." {break}\
"Is this ok \\\[y/N\\\]: " {interact}}\
{spawn yum install php-dom \
expect "Nothing to do." {break}\
"Is this ok \\\[y/N\\\]: " {interact}}}
"Phoronix install finished. RHEL OS." {spawn zypper install php \
expect "Nothing to do." {break}\
"Is this ok \\\[y/N\\\]: " {interact}}\
{spawn zypper install php-dom \
expect "Nothing to do." {break}\
"Is this ok \\\[y/N\\\]: " {interact}}}
PExpect is pretty nice, you should probably check it out.
Also, look into autoexpect if you need to do it in expect.