diff options
author | Rob Austein <sra@hactrn.net> | 2019-02-14 07:12:12 +0000 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2019-02-14 07:12:12 +0000 |
commit | 6f702a880c0c8300385945afead0a8e8d8236adc (patch) | |
tree | 591f5458ccb21c85cbb569e53c6970bfb6c8d910 | |
parent | d3a03cf27dab20ee49e2d245f6ca43c98c268cf8 (diff) |
Debug.
-rw-r--r-- | .dockerignore | 5 | ||||
-rw-r--r-- | .gitignore | 1 | ||||
-rwxr-xr-x | Builder1 | 17 | ||||
-rwxr-xr-x | Builder2 | 16 | ||||
-rw-r--r-- | Dockerfile | 2 | ||||
-rw-r--r-- | Makefile | 10 | ||||
-rwxr-xr-x | ratinox | 16 | ||||
-rwxr-xr-x | stage1 | 35 | ||||
-rwxr-xr-x | stage2 | 11 |
9 files changed, 51 insertions, 62 deletions
diff --git a/.dockerignore b/.dockerignore index 1be0fe1..79fc6cc 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,12 +1,11 @@ -framebuf/Xvfb_screen0 +Builder? .git .gitignore *.log Makefile ratinox README.md -stage1 -stage2 *.stamp Xilinx_ISE_DS_Lin_14.7_1015_1.tar Xilinx.lic +Xvfb_screen0* @@ -3,3 +3,4 @@ framebuf/Xvfb_screen0 *.stamp Xilinx_ISE_DS_Lin_14.7_1015_1.tar Xilinx.lic +Xvfb_screen0* diff --git a/Builder1 b/Builder1 new file mode 100755 index 0000000..5285458 --- /dev/null +++ b/Builder1 @@ -0,0 +1,17 @@ +#!/bin/sh - + +set -ex + +sed -i '/mount -t proc /d; /mount -t sysfs /d' /debootstrap/functions +/debootstrap/debootstrap --second-stage + +ln -sf /bin/bash /bin/sh + +apt-get update + +apt-get install -y \ + libglib2.0-0 \ + libxrandr2 \ + python-xvfbwrapper \ + ratpoison \ + sudo diff --git a/Builder2 b/Builder2 new file mode 100755 index 0000000..c464435 --- /dev/null +++ b/Builder2 @@ -0,0 +1,16 @@ +#!/bin/sh - + +set -ex + +/cryptech-builder/ratinox ise-install + +rm -rf /Xilinx_ISE_DS_Lin_14.7_1015_1 + +adduser --disabled-password --gecos 'Cryptech Build Bot' --shell /bin/sh builder +echo >/etc/sudoers.d/builder 'builder ALL = (ALL) NOPASSWD: SETENV: ALL' + +install -o builder -g builder /cryptech-builder/Xilinx.lic /home/builder/Xilinx.lic + +sudo -u builder /cryptech-builder/ratinox license-user + +rm $HOME/builder/Xilinx.lic @@ -1,4 +1,4 @@ -FROM cryptech-builder:stage2 +FROM cryptech-builder:stage1 RUN echo 'deb http://deb.debian.org/debian jessie-backports main' > /etc/apt/sources.list.d/backports.list @@ -11,16 +11,18 @@ stage0.stamp: stage1.stamp: stage0.stamp docker run -it --name cryptech-builder-stage1 \ --mount type=bind,source=$(abspath .),target=/cryptech-builder \ - cryptech-builder:stage0 /cryptech-builder/stage1 - docker commit -c 'USER builder' cryptech-builder-stage1 cryptech-builder:stage2 + cryptech-builder:stage0 \ + /cryptech-builder/Builder1 + docker commit cryptech-builder-stage1 cryptech-builder:stage1 docker container rm cryptech-builder-stage1 touch $@ stage2.stamp: stage1.stamp docker run -it --name cryptech-builder-stage2 \ --mount type=bind,source=$(abspath .),target=/cryptech-builder \ - cryptech-builder:stage1 /cryptech-builder/stage2 - docker commit -c 'USER builder' cryptech-builder-stage2 cryptech-builder:stage2 + cryptech-builder:stage1 \ + /cryptech-builder/Builder2 + docker commit cryptech-builder-stage2 cryptech-builder:stage2 docker container rm cryptech-builder-stage2 touch $@ @@ -12,30 +12,30 @@ class Ratinox(xvfbwrapper.Xvfb): def __init__(self, **kwargs): if kwargs.pop("screencap", True) and "fbdir" in kwargs: - self.screencap_file = os.path.join(kwargs["fbdir"], xvfb_screen_name) + self.screencap_file = os.path.join(kwargs["fbdir"], self.xvfb_screen_name) else: self.screencap_file = None - super(Ratinox, self).__init__(**kwargs) + xvfbwrapper.Xvfb.__init__(self, **kwargs) def __enter__(self): - result = super(Ratinox, self).__enter__() + result = xvfbwrapper.Xvfb.__enter__(self) self.wm = subprocess.Popen(("ratpoison",)) time.sleep(0.5) return result def __exit__(self, exc_type, exc_val, exc_tb): - self.rat("quit") + subprocess.check_call(("ratpoison", "-c", "quit")) self.wm.wait() self.wm = None - super(Ratinox, self).__exit__(exc_type, exc_val, exc_tb) + xvfbwrapper.Xvfb.__exit__(self, exc_type, exc_val, exc_tb) def click(self, *coordinates): assert len(coordinates) in (0, 2) if coordinates: - subproccess.check_call(("ratpoison", "-c", "ratwarp {:d} {:d}".format(*coordinates))) + subprocess.check_call(("ratpoison", "-c", "ratwarp {:d} {:d}".format(*coordinates))) if self.screencap_file: shutil.copy(self.screencap_file, "{}.{}".format(self.screencap_file, time.time())) - subproccess.check_call(("ratpoison", "-c", "ratclick")) + subprocess.check_call(("ratpoison", "-c", "ratclick")) def snooze(how_long = 15): time.sleep(how_long) @@ -122,7 +122,7 @@ def main(): ap.add_argument("command", choices = tuple(sorted(dispatch))) args = ap.parse_args() - dispatch[args.command] + dispatch[args.command]() if __name__ == "__main__": main() @@ -1,35 +0,0 @@ -#!/bin/sh - - -set -ex - -# Finish debootstrap (stage0 did debootstrap --foreign) - -sed -i '/mount -t proc /d; /mount -t sysfs /d' /debootstrap/functions -/debootstrap/debootstrap --second-stage - -# The XiLinx tools don't like dash but are OK with bash. - -ln -sf /bin/bash /bin/sh - -# Jump through hoops to install the XiLinx software in this container. - -apt-get update - -apt-get install -y \ - libglib2.0-0 \ - libxrandr2 \ - python-xvfbwrapper \ - ratpoison \ - sudo - -/cryptech-builder/ratinox ise-install - -# Assuming we survived that, we're done with the 6GB -# XiLinxinstallation package. - -rm -rf /Xilinx_ISE_DS_Lin_14.7_1015_1 - -# Create non-root user (with sudo privs, for pbuilder) - -adduser --disabled-password --gecos 'Cryptech Build Bot' --shell /bin/sh builder -echo >/etc/sudoers.d/builder 'builder ALL = (ALL) NOPASSWD: SETENV: ALL' @@ -1,11 +0,0 @@ -#!/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 |