diff --git a/compiler/ast_to_ir.py b/compiler/ast_to_ir.py index 3749dde57..16a640237 100644 --- a/compiler/ast_to_ir.py +++ b/compiler/ast_to_ir.py @@ -1002,4 +1002,3 @@ def ast_match(ast_node, cases, *args): return ast_match_untyped(ast_node, cases, *args) return cases[ast_node.construct.value](*args)(ast_node) - diff --git a/scripts/distro-deps.sh b/scripts/distro-deps.sh index 91528fa67..cca53fd79 100755 --- a/scripts/distro-deps.sh +++ b/scripts/distro-deps.sh @@ -14,9 +14,10 @@ read_cmd_args $@ cd $PASH_TOP # if we aren't running in docker, use sudo to install packages -if [ ! -f /.dockerenv ]; then - export SUDO="sudo" -fi +if ! ( isDockerBuildkit || isDocker || isDockerContainer ) +then + export SUDO="sudo" +fi if type lsb_release >/dev/null 2>&1 ; then distro=$(lsb_release -i -s) diff --git a/scripts/docker/debian/Dockerfile b/scripts/docker/debian/Dockerfile index d46b10253..013f2fdc6 100644 --- a/scripts/docker/debian/Dockerfile +++ b/scripts/docker/debian/Dockerfile @@ -1,7 +1,8 @@ FROM debian:10 - SHELL ["/bin/bash", "-c"] -RUN apt-get update -y && apt-get install -y git sudo +## Necessary to avoid interactive responses in installations +ENV DEBIAN_FRONTEND=noninteractive +RUN apt-get update -y && apt-get install -y git ## Install pyenv to install python3.8 RUN apt install -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev python-openssl diff --git a/scripts/docker/fedora/Dockerfile b/scripts/docker/fedora/Dockerfile index b94a8640b..db78837df 100644 --- a/scripts/docker/fedora/Dockerfile +++ b/scripts/docker/fedora/Dockerfile @@ -2,7 +2,7 @@ FROM fedora:35 RUN dnf install git -y ENV PASH_TOP=/opt/pash # download PaSh -RUN git clone --depth 1 https://github.com/binpash/pash.git /opt/pash +RUN git clone https://github.com/binpash/pash.git /opt/pash RUN bash /opt/pash/scripts/distro-deps.sh -o RUN yes | bash /opt/pash/scripts/setup-pash.sh -o ENV LANG en_US.UTF-8 diff --git a/scripts/docker/ubuntu/Dockerfile b/scripts/docker/ubuntu/Dockerfile index ba610eb14..55a5c78af 100644 --- a/scripts/docker/ubuntu/Dockerfile +++ b/scripts/docker/ubuntu/Dockerfile @@ -1,8 +1,10 @@ -FROM ubuntu:18.04 +FROM ubuntu:20.04 +## Necessary to avoid interactive responses in installations +ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update -y && apt-get install -y git ENV PASH_TOP=/opt/pash # download PaSh -RUN git clone --depth 1 https://github.com/binpash/pash.git /opt/pash +RUN git clone https://github.com/binpash/pash.git /opt/pash RUN bash /opt/pash/scripts/distro-deps.sh -o RUN yes | bash /opt/pash/scripts/setup-pash.sh -o ENV LANG en_US.UTF-8 diff --git a/scripts/utils.sh b/scripts/utils.sh index 578992d7e..dac5c976d 100755 --- a/scripts/utils.sh +++ b/scripts/utils.sh @@ -174,3 +174,17 @@ append_pash_to_rc() { fi done } + +isDocker(){ + local cgroup=/proc/1/cgroup + test -f $cgroup && [[ "$(<$cgroup)" = *:cpuset:/docker/* ]] +} + +isDockerBuildkit(){ + local cgroup=/proc/1/cgroup + test -f $cgroup && [[ "$(<$cgroup)" = *:cpuset:/docker/buildkit/* ]] +} + +isDockerContainer(){ + [ -e /.dockerenv ] +}