diff options
author | Michael Boelen <michael.boelen@cisofy.com> | 2017-08-08 15:52:11 +0300 |
---|---|---|
committer | Michael Boelen <michael.boelen@cisofy.com> | 2017-08-08 15:52:11 +0300 |
commit | 4660362e7417fab69cf8be2a32b0c50fe4b15f83 (patch) | |
tree | be4ab367508d413e3045adbd649494177d1e7423 /include | |
parent | 0c5b9b8148df45450f812a3ad723c4caccf1ff34 (diff) |
Redirect errors like file permissions
Diffstat (limited to 'include')
-rw-r--r-- | include/functions | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/include/functions b/include/functions index 615abf32..d8c7afea 100644 --- a/include/functions +++ b/include/functions @@ -1157,8 +1157,9 @@ IsContainer() { FOUND=0 + # Early on we can't use FileIsReadable yet if [ -e /proc/1/cgroup ]; then - FIND=$(cat /proc/1/cgroup | grep -i docker) + FIND=$(cat ${ROOTDIR}proc/1/cgroup 2> /dev/null | grep -i docker) if [ $? -eq 0 ]; then LogText "Result: found Docker in control groups (/proc/1/cgroup), so we are running in Docker container" CONTAINER_TYPE="Docker"; FOUND=1 @@ -1166,7 +1167,7 @@ fi fi if [ -e /proc/1/environ ]; then - FIND=$(grep -qa 'container=lxc' /proc/1/environ) + FIND=$(grep -qa 'container=lxc' ${ROOTDIR}proc/1/environ 2> /dev/null) if [ $? -eq 0 ]; then LogText "Result: found LXC in environnement (/proc/1/environ), so we are running in LXC container" CONTAINER_TYPE="LXC"; FOUND=1 @@ -1342,7 +1343,8 @@ # lxc environ detection if [ "${SHORT}" = "" ]; then if [ -f /proc/1/environ ]; then - if grep -qa 'container=lxc' /proc/1/environ; then + FIND=$(grep -qa 'container=lxc' /proc/1/environ 2> /dev/null) + if [ $? -eq 0 ]; then SHORT=lxc LogText "Result: found ${SHORT}" fi |