Skip to content

Instantly share code, notes, and snippets.

@dhood
Last active June 24, 2016 17:37
Show Gist options
  • Save dhood/2aa0809bdf19f7e78e74b1cb3b8da203 to your computer and use it in GitHub Desktop.
Save dhood/2aa0809bdf19f7e78e74b1cb3b8da203 to your computer and use it in GitHub Desktop.
import pexpect
import sys
if len(sys.argv) < 3:
raise Exception('Path to installer and/or install directory not received')
installer_path = sys.argv[1]
install_directory = sys.argv[2]
child = pexpect.spawn(installer_path + ' --mode text', encoding='utf8', logfile=sys.stdout)
spamEnter = True
while(spamEnter):
result = child.expect(['Installation Directory.*?:', 'Press \[Enter\] to continue:', 'Do you accept this license\? \[y/n\]: '])
print(child.before)
if result == 0:
spamEnter = False
else:
child.sendline('y')
child.sendline(install_directory)
child.expect_exact('Do you want to continue? [Y/n]: ')
print(child.before)
child.sendline('y')
result_index = child.expect_exact(['Create an RTI Launcher shortcut on the Desktop [y/N]: ', pexpect.EOF])
if result_index == 0:
print(child.before)
child.sendline('n')
child.expect(pexpect.EOF)
print(child.before)
print('rti_web_binaries_install_script finished.')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment