aboutsummaryrefslogtreecommitdiff
path: root/stage2
diff options
context:
space:
mode:
Diffstat (limited to 'stage2')
-rwxr-xr-xstage211
-rw-r--r--stage2/Dockerfile17
-rwxr-xr-xstage2/builder6
-rwxr-xr-xstage2/installer66
-rwxr-xr-xstage2/licenser42
5 files changed, 11 insertions, 131 deletions
diff --git a/stage2 b/stage2
new file mode 100755
index 0000000..01b67a8
--- /dev/null
+++ b/stage2
@@ -0,0 +1,11 @@
+#!/bin/sh -
+
+set -ex
+
+# We should now be running as a non-root user, set up the XiLinx license
+
+sudo install -o builder -g builder /cryptech-builder/Xilinx.lic $HOME/builder
+
+/cryptech-builder/ratinox license-user
+
+rm $HOME/builder
diff --git a/stage2/Dockerfile b/stage2/Dockerfile
deleted file mode 100644
index f9fc768..0000000
--- a/stage2/Dockerfile
+++ /dev/null
@@ -1,17 +0,0 @@
-FROM cryptech-builder:stage1
-
-RUN ln -sf /bin/bash /bin/sh
-
-RUN apt-get update && apt-get install -y \
- libglib2.0-0 \
- libxrandr2 \
- python-xvfbwrapper \
- ratpoison
-
-COPY builder installer licenser /xilinx-unpack/
-
-# For the moment we're licensing as root. Probably need to change
-# that since building as root is a really bad idea. License file goes
-# in home directory of user who will be running the builds.
-
-COPY Xilinx.lic /root
diff --git a/stage2/builder b/stage2/builder
deleted file mode 100755
index ac3432b..0000000
--- a/stage2/builder
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/sh
-
-set -ex
-cd /xilinx-unpack
-./installer
-./licenser
diff --git a/stage2/installer b/stage2/installer
deleted file mode 100755
index b3bb5ba..0000000
--- a/stage2/installer
+++ /dev/null
@@ -1,66 +0,0 @@
-#!/usr/bin/env python
-
-import subprocess, os, time, xvfbwrapper, itertools
-
-def run(*args, **kwargs):
- return subprocess.Popen(args, **kwargs)
-
-def ratpoison(*args):
- return subprocess.check_output(("ratpoison",) + tuple(itertools.chain.from_iterable(("-c", a) for a in args)))
-
-def snooze(how_long = 15):
- time.sleep(how_long)
-
-def main():
- with xvfbwrapper.Xvfb(fbdir = "/framebuf"):
- print("DISPLAY={}".format(os.getenv("DISPLAY")))
-
- print("Starting rodent-free window manager")
- rat = run("ratpoison")
-
- snooze()
- print("Starting XiLinx installer")
- xsetup = run("./xsetup", cwd = "/xilinx-unpack/Xilinx_ISE_DS_Lin_14.7_1015_1")
-
- snooze()
- print("First screen")
- ratpoison("ratwarp 650 610", "ratclick")
-
- snooze()
- print("Second screen")
- ratpoison("ratwarp 250 420", "ratclick",
- "ratwarp 250 444", "ratclick",
- "ratwarp 650 610", "ratclick")
-
- snooze()
- print("Third screen")
- ratpoison("ratwarp 600 560", "ratclick",
- "ratwarp 650 610", "ratclick")
-
- snooze()
- print("Fourth screen")
- ratpoison("ratwarp 300 100", "ratclick",
- "ratwarp 650 610", "ratclick")
-
- for ith in ("Fifth", "Sixth", "Seventh"):
- snooze()
- print(ith + " screen")
- ratpoison("ratclick")
-
- 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, then shutting down")
- ratpoison("ratwarp 720 610", "ratclick",
- "quit")
-
- print("xsetup exited with status {}".format(xsetup.wait()))
- print("ratpoison exited with status {}".format(rat.wait()))
-
-if __name__ == "__main__":
- main()
diff --git a/stage2/licenser b/stage2/licenser
deleted file mode 100755
index 3bccb83..0000000
--- a/stage2/licenser
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/usr/bin/env python
-
-import subprocess, os, time, xvfbwrapper, itertools
-
-def ratpoison(*args):
- return subprocess.check_output(("ratpoison",) + tuple(itertools.chain.from_iterable(("-c", a) for a in args)))
-
-def snooze(how_long = 15):
- time.sleep(how_long)
-
-def main():
- with xvfbwrapper.Xvfb(fbdir = "/framebuf"):
- print("DISPLAY={}".format(os.getenv("DISPLAY")))
-
- print("Starting rodent-free window manager")
- rat = subprocess.Popen(["ratpoison"])
-
- snooze()
- print("Starting XiLinx license manager")
- xlcm = ". /opt/Xilinx/14.7/ISE_DS/settings64.sh; /opt/Xilinx/14.7/ISE_DS/common/bin/lin64/xlcm -manage"
- xlcm = subprocess.Popen(xlcm, shell = True)
-
- snooze()
- print("First screen")
- ratpoison("ratwarp 100 116", "ratclick")
-
- snooze()
- print("Second screen")
- ratpoison("ratwarp 220 170", "ratclick",
- "ratwarp 680 490", "ratclick")
-
- snooze()
- print("Third screen")
- ratpoison("ratwarp 400 360", "ratclick",
- "ratwarp 750 650", "ratclick",
- "quit")
-
- print("xlcm exited with status {}".format(xlcm.wait()))
- print("ratpoison exited with status {}".format(rat.wait()))
-
-if __name__ == "__main__":
- main()