diff options
author | Rob Austein <sra@hactrn.net> | 2019-02-14 21:11:14 +0000 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2019-02-14 21:11:14 +0000 |
commit | f7bd5d48daaff0980fcccefcfbb884db611448a8 (patch) | |
tree | 19099c1a5320dbb65fc14b9accbc82e8caa79cf6 /Ratinox | |
parent | 1310e0b5635ee2bd4215a2fbfaa23b7d15e0377c (diff) |
Different theory for license manager problem
Diffstat (limited to 'Ratinox')
-rwxr-xr-x | Ratinox | 96 |
1 files changed, 96 insertions, 0 deletions
@@ -0,0 +1,96 @@ +#!/usr/bin/env python + +""" +Perform demented installation tasks with blind rodents. +""" + +import subprocess, os, time, xvfbwrapper, shutil, argparse + +screencap_dir = "/cryptech-builder" + +screencap_file = os.path.join(screencap_dir, "Xvfb_screen0") + +def snooze(how_long = 15): + time.sleep(how_long) + +def click(*coordinates): + assert len(coordinates) in (0, 2) + if coordinates: + subprocess.check_call(("ratpoison", "-c", "ratwarp {:d} {:d}".format(*coordinates))) + shutil.copy(screencap_file, "{}.{:f}".format(screencap_file, time.time())) + subprocess.check_call(("ratpoison", "-c", "ratclick")) + +with xvfbwrapper.Xvfb(fbdir = screencap_dir): + print("DISPLAY={}".format(os.getenv("DISPLAY"))) + + print("Starting rodent-free window manager") + rat = subprocess.Popen(("ratpoison",)) + time.sleep(0.5) + + snooze() + print("Starting XiLinx installer") + xsetup = subprocess.Popen(("./xsetup",), cwd = "/Xilinx_ISE_DS_Lin_14.7_1015_1") + + snooze() + print("First screen") + click(650, 610) + + snooze() + print("Second screen") + click(250, 420) + click(250, 444) + click(650, 610) + + snooze() + print("Third screen") + click(600, 560) + click(650, 610) + + snooze() + print("Fourth screen") + click(300, 100) + click(650, 610) + + for ith in ("Fifth", "Sixth", "Seventh"): + snooze() + print(ith + " screen") + click() + + print("Waiting half an hour for XiLinx installer to run, ^C if you get bored") + snooze(1800) + + # In theory we could use visgrep to check for the "finish" button. + # In practice ... this is such a kludge, what's one more, let's just + # try blindly clicking where the finish button should be and see + # if that results in a usable image. + + print("Blindly clicking where finish button should be") + click(720, 610) + + print("xsetup exited with status {}".format(xsetup.wait())) + + snooze() + print("Starting XiLinx license manager") + xlcm = subprocess.Popen(". /opt/Xilinx/14.7/ISE_DS/settings64.sh; /opt/Xilinx/14.7/ISE_DS/common/bin/lin64/xlcm -manage", + shell = True, cwd = "/home/builder", env = dict(os.environ, USER = "builder", HOME = "/home/builder")) + + snooze() + print("First screen") + click(100, 116) + + snooze() + print("Second screen") + click(220, 170) + click(680, 490) + + snooze() + print("Third screen") + click(400, 360) + click(750, 650) + + print("xlcm exited with status {}".format(xlcm.wait())) + + print("Shutting down") + subprocess.check_call(("ratpoison", "-c", "quit")) + + print("ratpoison exited with status {}".format(rat.wait())) |