Apt-get insatll -y User Input

I am trying to create a docker image of our build server so that we can quickly and easily replicate it for each build we do.

I am presently hitting an issue when I try to install a package we need seems to require user input to install, it’s the STM32 CubeIDE.

I am able to copy the shell script installer (STM32CubeIDE Debian Linux Installer) from the link below into my docker container:

https://my.st.com/content/my_st_com/en/products/development-tools/software-development-tools/stm32-software-development-tools/stm32-ides/stm32cubeide.license=1575955524053.product=STM32CubeIDE-DEB.version=1.1.0.html

I then run the following commands to extract the .deb packages from the shell script using the command below:

./st-stm32cubeide_1.1.0_4551_20191014_1140_amd64.deb_bundle.sh --noexec --target /opt/cubeIDE/

This creates individual .deb packages which I then install using the following apt-get install -y

apt-get install -y /opt/cubeIDE/segger-jlink-udev-rules-6.44c-4-linux-all.deb

apt-get install -y /opt/cubeIDE/st-stlink-server-1.2.0-3-linux-amd64.deb

apt-get install -y /opt/cubeIDE/st-stlink-udev-rules-1.0.2-2-linux-all.deb

When I try to install the final STMCubeIDE package, I am unable to get past the request for input on the EULA request for y/n. (see screen shot image - I can;t add two images as new user, will try and post it later.).

I have tried the command below, but the prompt still keeps coming:

DEBIAN_FRONTEND=‘noninteractive’ apt-get install -y --no-install-recommends cubeIDE/st-stm32cubeide_1.1.0_4551_20191014_1140_amd64.deb

Even with the -y switch on the apt-get install command I’m still prompted to accept the EULA :frowning:

I have also tried to pipe in a y using the following:

echo y | DEBIAN_FRONTEND=‘noninteractive’ apt-get install -y --no-install-recommends cubeIDE/st-stm32cubeide_1.1.0_4551_20191014_1140_amd64.deb

and

y | DEBIAN_FRONTEND=‘noninteractive’ apt-get install -y --no-install-recommends cubeIDE/st-stm32cubeide_1.1.0_4551_20191014_1140_amd64.deb

But it still hangs or errors in when I build the container, the error is actually slightly different when thecontainer builds, but I beleive it is the same reason.

Any tips or tricks I can use to get around this would be, much appreciated!

Here, is the image!

So I spent some time digging into a .deb file and find out there is a “preinst” as part of the debian package which is running the troublesome prompt_license.sh script…

#!/usr/bin/env sh

set -e
thisdir=$(dirname $0)
bash $thisdir/prompt_license.sh

I just need to hook that shell script some how or stop it running maybe! :confused:

This feels like the public ramblings of a mad man, but this is my solution at the minute…

RUN mkdir tmp &&
         dpkg-deb -R original.deb tmp &&
         sed 's/bash/#bash/g' /tmp/DEBIAN/preinst
         dpkg-deb -b tmp fixed.deb

RUN apt-get install -y fixed.deb

But is there a better or more elegant way? I don’t like the need to depackage and then package up again all in a docker image feels a bit much?