From 50aee51593feb502ca946efeb20ff079dd12f4f2 Mon Sep 17 00:00:00 2001 From: Andrea Merello Date: Thu, 21 May 2020 15:54:59 +0200 Subject: [PATCH] Kill webeserver, even if slower stick with easy stuff. Make setup script independent by screen size. Install webpack --- .dockerignore | 1 - Dockerfile | 37 +++++++++++++++++++--------- build | 25 +------------------ files/root/setup | 26 ------------------- files/{root => tmp}/.Xilinx/.gitkeep | 0 files/{root => tmp}/.bashrc | 0 files/{root => tmp}/install/config | 29 +++++++++++----------- files/tmp/setup | 22 +++++++++++++++++ run-docker-ssh | 27 ++++++++++++++++++++ 9 files changed, 90 insertions(+), 77 deletions(-) delete mode 100644 .dockerignore delete mode 100755 files/root/setup rename files/{root => tmp}/.Xilinx/.gitkeep (100%) rename files/{root => tmp}/.bashrc (100%) rename files/{root => tmp}/install/config (88%) create mode 100755 files/tmp/setup create mode 100755 run-docker-ssh diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index 9bcc25c..0000000 --- a/.dockerignore +++ /dev/null @@ -1 +0,0 @@ -xilinx-installer diff --git a/Dockerfile b/Dockerfile index 02240aa..d86e5e1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,24 +2,39 @@ FROM ubuntu:14.04 # basic packages RUN apt-get update && \ - apt-get -y install git expect emacs24-nox locales \ + apt-get -y install git expect locales \ libglib2.0-0 libsm6 libxi6 libxrender1 libxrandr2 \ - libfreetype6 libfontconfig1 wget + libfreetype6 libfontconfig1 + +# some essential tools.. +RUN apt-get update && \ + apt-get -y install nano usbutils # Set LOCALE to UTF8 RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && \ locale-gen en_US.UTF-8 && \ /usr/sbin/update-locale LANG=en_US.UTF-8 + +RUN mkdir -p /tmp/install +# adding xilinx installer +COPY xilinx-installer/Xilinx_ISE_DS_14.7_1015_1-1.tar /tmp +COPY xilinx-installer/Xilinx_ISE_DS_14.7_1015_1-3.zip.xz /tmp +COPY xilinx-installer/Xilinx_ISE_DS_14.7_1015_1-2.zip.xz /tmp +COPY xilinx-installer/Xilinx_ISE_DS_14.7_1015_1-4.zip.xz /tmp + # adding scripts ADD files / -RUN cd /root/install && \ - wget "http://127.0.0.1:8765/Xilinx_ISE_DS_14.7_1015_1-1.tar" && \ - wget "http://127.0.0.1:8765/Xilinx_ISE_DS_14.7_1015_1-2.zip.xz" && \ - wget "http://127.0.0.1:8765/Xilinx_ISE_DS_14.7_1015_1-3.zip.xz" && \ - wget "http://127.0.0.1:8765/Xilinx_ISE_DS_14.7_1015_1-4.zip.xz" && \ - tar xvf Xilinx_ISE_DS_14.7_1015_1-1.tar && \ - TERM=xterm /root/setup && \ - cd && \ - rm -rf /root/setup /root/install +RUN cd /tmp/install && \ + tar xvf ../Xilinx_ISE_DS_14.7_1015_1-1.tar + +RUN cd /tmp/install && TERM=xterm /tmp/setup && \ + cd + +RUN adduser --disabled-password --gecos '' ise +USER ise +WORKDIR /home/ise + +#source ise settings +RUN echo "source /opt/Xilinx/14.7/ISE_DS/settings64.sh" >> /home/ise/.bashrc diff --git a/build b/build index 9debe2d..af9a4a8 100755 --- a/build +++ b/build @@ -1,26 +1,3 @@ #!/bin/bash -set -e - -cd $(dirname $0) - -DOCKER_TARGET=${DOCKER_TARGET:-docker.i74.de:5000} -IMAGE_NAME=xilinx-ise -IMAGE_TAG=14.7 - -# start small webserver to hold install files -cd xilinx-installer -python3 -m http.server 8765 --bind 127.0.0.1 >/dev/null 2>&1 & -HTTP_SERVER_PID=$! -trap "echo 'stopping $HTTP_SERVER_PID' ; if [ $HTTP_SERVER_PID ] ; then kill $HTTP_SERVER_PID ; fi" SIGINT SIGTERM EXIT -cd .. - -docker build --network host --rm -t ${DOCKER_TARGET}/${IMAGE_NAME}:${IMAGE_TAG} . -docker tag ${DOCKER_TARGET}/${IMAGE_NAME}:${IMAGE_TAG} ${DOCKER_TARGET}/${IMAGE_NAME}:latest - -read -n1 -p "Do you want to push the image to the registry now [yN]? " answer -if [[ "${answer:-n}" == "y" ]] -then - docker push ${DOCKER_TARGET}/${IMAGE_NAME}:${IMAGE_TAG} - docker push ${DOCKER_TARGET}/${IMAGE_NAME}:latest -fi +docker build -t ise-14-7 . diff --git a/files/root/setup b/files/root/setup deleted file mode 100755 index 356fcdf..0000000 --- a/files/root/setup +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/expect - -set timeout -1 - -spawn /root/install/bin/lin64/batchxsetup -batch config - -set count 23; set done 0; set todo $count; -while {$count > 0 } { - set done [expr $done+1]; - expect "Press Enter key to continue" { send "\r" } - puts "\n\ndone : $done/$todo\n\n"; - set count [expr $count-1]; -} - -expect "I accept and agree to the terms and conditions above." { send "y\r" } - -set count 2566; set done 0; set todo $count; -while {$count > 0 } { - set done [expr $done+1]; - expect "Press Enter key to continue" { send "\r" } - puts "\n\ndone : $done/$todo\n\n"; - set count [expr $count-1]; -} - -expect "I accept and agree to the terms and conditions above." { send "y\r" } -expect eof diff --git a/files/root/.Xilinx/.gitkeep b/files/tmp/.Xilinx/.gitkeep similarity index 100% rename from files/root/.Xilinx/.gitkeep rename to files/tmp/.Xilinx/.gitkeep diff --git a/files/root/.bashrc b/files/tmp/.bashrc similarity index 100% rename from files/root/.bashrc rename to files/tmp/.bashrc diff --git a/files/root/install/config b/files/tmp/install/config similarity index 88% rename from files/root/install/config rename to files/tmp/install/config index 0153098..bb36bd2 100644 --- a/files/root/install/config +++ b/files/tmp/install/config @@ -4,7 +4,7 @@ destination_dir=/opt/Xilinx -downloadlocation_dir=/root/install +downloadlocation_dir=/tmp/ # &Import tool preferences from previous version copy_preferences=N @@ -21,11 +21,11 @@ application=Acquire or Manage a License Key::0 # comment all other blocks to install ISE WebPACK ################################################################ -# package=ISE WebPACK::0 -# application=setupEnv.sh::0 -# application=Install Linux System Generator Info XML::0 -# application=Ensure Linux System Generator Symlinks::0 -# application=Install Cable Drivers::0 +package=ISE WebPACK::1 +application=setupEnv.sh::0 +application=Install Linux System Generator Info XML::0 +application=Ensure Linux System Generator Symlinks::0 +application=Install Cable Drivers::0 ################################################################ @@ -76,14 +76,14 @@ application=Acquire or Manage a License Key::0 # comment all other blocks to install ISE Design Suite System Edition ################################################################ -package=ISE Design Suite System Edition::1 -application=setupEnv.sh::0 -application=Ensure Linux System Generator Symlinks::0 -application=Install Linux System Generator Info XML::0 -application=Configure WebTalk::0 -application=Enable WebTalk to send software, IP and device usage statistics to Xilinx (Always enabled for WebPACK license)::0 -application=Install Cable Drivers::0 -application=Version Equalizer::0 +#package=ISE Design Suite System Edition::1 +#application=setupEnv.sh::0 +#application=Ensure Linux System Generator Symlinks::0 +#application=Install Linux System Generator Info XML::0 +#application=Configure WebTalk::0 +#application=Enable WebTalk to send software, IP and device usage statistics to Xilinx (Always enabled for WebPACK license)::0 +#application=Install Cable Drivers::0 +#application=Version Equalizer::0 ################################################################ @@ -95,4 +95,3 @@ application=Version Equalizer::0 # application=Configure WebTalk::0 # application=Enable WebTalk to send software, IP and device usage statistics to Xilinx (Always enabled for WebPACK license)::0 # application=Install Cable Drivers::0 - diff --git a/files/tmp/setup b/files/tmp/setup new file mode 100755 index 0000000..48b2b90 --- /dev/null +++ b/files/tmp/setup @@ -0,0 +1,22 @@ +#!/usr/bin/expect + +set timeout 2 + +spawn /tmp/install/bin/lin64/batchxsetup -batch config + +set GO 1 +while {$GO > 0} { + expect "Press Enter key to continue" { send "\r" } timeout { set GO 0 } +} + +expect "I accept and agree to the terms and conditions above." { send "y\r" } + +set GO 1 +while {$GO > 0} { + expect "Press Enter key to continue" { send "\r" } timeout { set GO 0 } +} + +expect "I accept and agree to the terms and conditions above." { send "y\r" } + +set timeout -1 +expect eof diff --git a/run-docker-ssh b/run-docker-ssh new file mode 100755 index 0000000..9603acb --- /dev/null +++ b/run-docker-ssh @@ -0,0 +1,27 @@ +#!/bin/bash +#https://blog.yadutaf.fr/2017/09/10/running-a-graphical-app-in-a-docker-container-on-a-remote-server/ + +# Prepare target env +CONTAINER_HOME="ise" +HOST_DOCKER_IP=172.17.0.1 + +# Create a directory for the socket +#mkdir -p display/socket + +echo "" > Xauthority + +# Get the DISPLAY slot +DISPLAY_NUMBER=$(echo $DISPLAY | cut -d. -f1 | cut -d: -f2) + +# Extract current authentication cookie +AUTH_COOKIE=$(xauth list ${DISPLAY} | awk '{print $3}') + +# Create the new X Authority file +xauth -f Xauthority add ${HOST_DOCKER_IP}:${DISPLAY_NUMBER} MIT-MAGIC-COOKIE-1 ${AUTH_COOKIE} + +# Launch the container +docker run -it --rm \ + -e DISPLAY=${HOST_DOCKER_IP}:${DISPLAY_NUMBER} \ + -v ${PWD}/Xauthority:/home/${CONTAINER_HOME}/.Xauthority \ + -v /home/andrea/PROGETTI/FPGA:/home/${CONTAINER_HOME}/work \ + ise-14-7 /bin/bash