From 3ce2056dc5c0a525b453f8708ff6ce9412f11ac4 Mon Sep 17 00:00:00 2001 From: Leonardo Di Donato Date: Tue, 5 Nov 2019 15:31:09 +0000 Subject: [PATCH] fix(docker): glob rather than ls in the docker entrypoints Plus, make them use HOST_ROOT env var, not SYSDIG_HOST_ROOT Signed-off-by: Leonardo Di Donato --- docker/dev/docker-entrypoint.sh | 12 +++++++----- docker/local/docker-entrypoint.sh | 12 +++++++----- docker/rhel/docker-entrypoint.sh | 12 +++++++----- docker/stable/docker-entrypoint.sh | 12 +++++++----- 4 files changed, 28 insertions(+), 20 deletions(-) diff --git a/docker/dev/docker-entrypoint.sh b/docker/dev/docker-entrypoint.sh index 102951c6..fe0687e6 100755 --- a/docker/dev/docker-entrypoint.sh +++ b/docker/dev/docker-entrypoint.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # # Copyright (C) 2019 The Falco Authors. # @@ -16,19 +16,21 @@ # limitations under the License. # -#set -e +# set -e # Set the SYSDIG_SKIP_LOAD variable to skip loading the sysdig kernel module if [[ -z "${SYSDIG_SKIP_LOAD}" ]]; then echo "* Setting up /usr/src links from host" - for i in $(ls $SYSDIG_HOST_ROOT/usr/src) + for i in "$HOST_ROOT/usr/src"/* do - ln -s $SYSDIG_HOST_ROOT/usr/src/$i /usr/src/$i + if [ -f "$i" ]; then + ln -s "$i" "/usr/src/$i" + fi done /usr/bin/falco-probe-loader fi -exec "$@" +exec "$@" \ No newline at end of file diff --git a/docker/local/docker-entrypoint.sh b/docker/local/docker-entrypoint.sh index 102951c6..fe0687e6 100755 --- a/docker/local/docker-entrypoint.sh +++ b/docker/local/docker-entrypoint.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # # Copyright (C) 2019 The Falco Authors. # @@ -16,19 +16,21 @@ # limitations under the License. # -#set -e +# set -e # Set the SYSDIG_SKIP_LOAD variable to skip loading the sysdig kernel module if [[ -z "${SYSDIG_SKIP_LOAD}" ]]; then echo "* Setting up /usr/src links from host" - for i in $(ls $SYSDIG_HOST_ROOT/usr/src) + for i in "$HOST_ROOT/usr/src"/* do - ln -s $SYSDIG_HOST_ROOT/usr/src/$i /usr/src/$i + if [ -f "$i" ]; then + ln -s "$i" "/usr/src/$i" + fi done /usr/bin/falco-probe-loader fi -exec "$@" +exec "$@" \ No newline at end of file diff --git a/docker/rhel/docker-entrypoint.sh b/docker/rhel/docker-entrypoint.sh index 102951c6..fe0687e6 100755 --- a/docker/rhel/docker-entrypoint.sh +++ b/docker/rhel/docker-entrypoint.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # # Copyright (C) 2019 The Falco Authors. # @@ -16,19 +16,21 @@ # limitations under the License. # -#set -e +# set -e # Set the SYSDIG_SKIP_LOAD variable to skip loading the sysdig kernel module if [[ -z "${SYSDIG_SKIP_LOAD}" ]]; then echo "* Setting up /usr/src links from host" - for i in $(ls $SYSDIG_HOST_ROOT/usr/src) + for i in "$HOST_ROOT/usr/src"/* do - ln -s $SYSDIG_HOST_ROOT/usr/src/$i /usr/src/$i + if [ -f "$i" ]; then + ln -s "$i" "/usr/src/$i" + fi done /usr/bin/falco-probe-loader fi -exec "$@" +exec "$@" \ No newline at end of file diff --git a/docker/stable/docker-entrypoint.sh b/docker/stable/docker-entrypoint.sh index 102951c6..fe0687e6 100755 --- a/docker/stable/docker-entrypoint.sh +++ b/docker/stable/docker-entrypoint.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # # Copyright (C) 2019 The Falco Authors. # @@ -16,19 +16,21 @@ # limitations under the License. # -#set -e +# set -e # Set the SYSDIG_SKIP_LOAD variable to skip loading the sysdig kernel module if [[ -z "${SYSDIG_SKIP_LOAD}" ]]; then echo "* Setting up /usr/src links from host" - for i in $(ls $SYSDIG_HOST_ROOT/usr/src) + for i in "$HOST_ROOT/usr/src"/* do - ln -s $SYSDIG_HOST_ROOT/usr/src/$i /usr/src/$i + if [ -f "$i" ]; then + ln -s "$i" "/usr/src/$i" + fi done /usr/bin/falco-probe-loader fi -exec "$@" +exec "$@" \ No newline at end of file