mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-22 17:55:57 +01:00
New explicit Docker selection based on environment variable
Everything else breaks after a few years I give up.
This commit is contained in:
@@ -2,5 +2,7 @@
|
|||||||
FROM ubuntu:20.04
|
FROM ubuntu:20.04
|
||||||
COPY setup /
|
COPY setup /
|
||||||
COPY requirements.txt /
|
COPY requirements.txt /
|
||||||
|
# https://stackoverflow.com/questions/23513045/how-to-check-if-a-process-is-running-inside-docker-container/65942222#65942222
|
||||||
|
ENV LKMC_IN_DOCKER=true
|
||||||
RUN /setup -y
|
RUN /setup -y
|
||||||
CMD bash
|
CMD bash
|
||||||
|
|||||||
10
setup
10
setup
@@ -6,14 +6,18 @@ if [ $# -eq 1 ]; then
|
|||||||
else
|
else
|
||||||
y=
|
y=
|
||||||
fi
|
fi
|
||||||
indocker="$(set +e; grep -q docker /proc/1/cgroup; echo $?)"
|
if [ true = "$LKMC_IN_DOCKER" ]; then
|
||||||
if [ "$indocker" -eq 0 ]; then
|
indocker=true
|
||||||
|
else
|
||||||
|
indocker=false
|
||||||
|
fi
|
||||||
|
if "$indocker"; then
|
||||||
sudo=
|
sudo=
|
||||||
export DEBIAN_FRONTEND=noninteractive
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
else
|
else
|
||||||
sudo=sudo
|
sudo=sudo
|
||||||
fi
|
fi
|
||||||
if [ "$indocker" -eq 0 ]; then
|
if "$indocker"; then
|
||||||
$sudo apt update
|
$sudo apt update
|
||||||
apt install -y software-properties-common
|
apt install -y software-properties-common
|
||||||
add-apt-repository -y ppa:git-core/ppa
|
add-apt-repository -y ppa:git-core/ppa
|
||||||
|
|||||||
Reference in New Issue
Block a user