From 14f58f8675556bfed43db96740417c3e3f27ebe4 Mon Sep 17 00:00:00 2001 From: Dan Witt Date: Sat, 8 Feb 2020 19:58:00 -0700 Subject: [PATCH] Adding the parts needed to run x48 in a Docker container, for more portability. --- Dockerfile | 28 ++++++++++++++++++++++++++++ runx48.sh | 29 +++++++++++++++++++++++++++++ src/x48_x11.c | 1 + 3 files changed, 58 insertions(+) create mode 100644 Dockerfile create mode 100755 runx48.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..95e7f5e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,28 @@ +FROM i386/alpine:3.11 AS build + +#Install the necessary things to build x48 +RUN apk update && apk add bzip2 make vim gcc libx11-dev autoconf automake libc6-compat man-pages xtrans libxau-dev libxdmcp-dev libx11-dev pkgconf libxt-dev g++ + +#Copy over the necessary files to build x48 +WORKDIR /app +COPY configure.ac version.m4 Makefile.am autogen.sh INSTALL NEWS README AUTHORS ChangeLog ./ +COPY src src +COPY romdump romdump +COPY rpm rpm +COPY ROMs ROMs +COPY utils utils +RUN ./autogen.sh +RUN ./configure +RUN make +RUN cd ROMs; bunzip2 *.bz2 + +#Squash the layers into a smaller image with only the necessary parts. +FROM i386/alpine:3.11 as final +WORKDIR /app +COPY --from=build /app/src/x48 . +COPY --from=build /app/ROMs ./ +COPY --from=build /usr/lib/libX11.so.6 /usr/lib/libxcb.so.1 /usr/lib/libXau.so.6 /usr/lib/libXdmcp.so.6 /usr/lib/libbsd.so.0 /usr/lib/ + + +ENTRYPOINT ["./x48","-quiet"] +CMD ["-rom", "gxrom-r"] diff --git a/runx48.sh b/runx48.sh new file mode 100755 index 0000000..d8b5480 --- /dev/null +++ b/runx48.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +#TODO: +# Check for the docker exec and that the user has access to start containers. + +start_x48 () { + docker run --rm --network none \ + --volume="/tmp/.X11-unix:/tmp/.X11-unix" \ + --volume="/home/$USER:/home/$USER" \ + --volume="/etc/group:/etc/group:ro" \ + --volume="/etc/passwd:/etc/passwd:ro" \ + --volume="/etc/shadow:/etc/shadow:ro" \ + --volume="/etc/sudoers.d:/etc/sudoers.d:ro" \ + --env="DISPLAY" \ + --user $(id -u):$(id -g) \ + danwitt/x48 $@ +} + +# IF we can't pull the image, then we need to build it +if [[ $1 == "--build" ]]; then + #Run the build process + docker build -t danwitt/x48 . + #If the build was good, start x48 + if [[ $? == 0 ]]; then + start_x48 $@ + fi +else + start_x48 $@ +fi diff --git a/src/x48_x11.c b/src/x48_x11.c index 4a41af2..bc0f323 100644 --- a/src/x48_x11.c +++ b/src/x48_x11.c @@ -3630,6 +3630,7 @@ int buflen; #endif case XK_KP_Multiply: case XK_asterisk: + case XK_comma: key_event(BUTTON_MUL, xev); wake = 1; break;