From 749a7d0e4f9da13f238062ae0417e68128c589fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Petazzoni?= Date: Fri, 9 Aug 2013 17:43:02 -0700 Subject: [PATCH] Add a check to make sure that make.sh only runs within a container. --- make.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/make.sh b/make.sh index 411271895b..63bb31bdb5 100755 --- a/make.sh +++ b/make.sh @@ -21,6 +21,16 @@ set -e set -x +# We're a nice, sexy, little shell script, and people might try to run us; +# but really, they shouldn't. We want to be in a container! +RESOLVCONF=$(readlink --canonicalize /etc/resolv.conf) +grep -q "$RESOLVCONF" /proc/mounts || { + echo "# I will only run within a container." + echo "# Try this instead:" + echo "docker build ." + exit 1 +} + VERSION=$(cat ./VERSION) GIT_COMMIT=$(git rev-parse --short HEAD) GIT_CHANGES=$(test -n "$(git status --porcelain)" && echo "+CHANGES" || true)