Make setup.sh work with Podman

Containers created with Podman (https://podman.io/) don't have a
.dockerenv file in the root directory, so setup.sh tries to invoke sudo.
This doesn't work because podman containers can't use sudo (the
processes inside the container run as an unprivileged user).
This removes the check for .dockerenv. The other checks should already
be sufficient to detect that it's running in a container without sudo.
pull/942/head
Matteo Rizzo 4 years ago committed by Disconnect3d
parent 72ca4d8fc0
commit 45dd669a23

3
.gitignore vendored

@ -69,3 +69,6 @@ tests/.pytest_cache/
tests/binaries/*.o
tests/binaries/*.out
tests/binaries/gosample.x*
# VS Code files
.vscode/

@ -5,10 +5,10 @@ echo "# Install testing tools."
echo "# Only works with Ubuntu / APT."
echo "# --------------------------------------"
# If we are a root in a Docker container and `sudo` doesn't exist
# If we are a root in a container and `sudo` doesn't exist
# lets overwrite it with a function that just executes things passed to sudo
# (yeah it won't work for sudo executed with flags)
if [ -f /.dockerenv ] && ! hash sudo 2>/dev/null && whoami | grep root; then
if ! hash sudo 2>/dev/null && whoami | grep root; then
sudo() {
${*}
}

@ -1,10 +1,10 @@
#!/bin/bash
set -ex
# If we are a root in a Docker container and `sudo` doesn't exist
# If we are a root in a container and `sudo` doesn't exist
# lets overwrite it with a function that just executes things passed to sudo
# (yeah it won't work for sudo executed with flags)
if [ -f /.dockerenv ] && ! hash sudo 2>/dev/null && whoami | grep root; then
if ! hash sudo 2>/dev/null && whoami | grep root; then
sudo() {
${*}
}

Loading…
Cancel
Save