diff options
author | Alec Warner <antarus@gentoo.org> | 2019-09-24 23:36:58 -0700 |
---|---|---|
committer | Alec Warner <antarus@gentoo.org> | 2019-09-24 23:36:58 -0700 |
commit | d59dff54661ff0349786a6fc84f894d813fb8f38 (patch) | |
tree | 57aaaaef9d0fe87951547bd2afd21bdd3c61baf3 | |
parent | bin/update-all: handle non-docker dev environment (diff) | |
download | packages-5-d59dff54661ff0349786a6fc84f894d813fb8f38.tar.gz packages-5-d59dff54661ff0349786a6fc84f894d813fb8f38.tar.bz2 packages-5-d59dff54661ff0349786a6fc84f894d813fb8f38.zip |
Fix in_docker check.v7.0.2
When not in docker /proc/1/cgroup may not exist.
Signed-off-by: Alec Warner <antarus@gentoo.org>
-rwxr-xr-x | bin/update-all.sh | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/bin/update-all.sh b/bin/update-all.sh index 2c1781f..c05277d 100755 --- a/bin/update-all.sh +++ b/bin/update-all.sh @@ -7,8 +7,13 @@ # to portage-owned files. However, in a Docker environment, the other files # from Portage are NOT available unless --sync IS used. +function in_docker() { + path=/proc/1/cgroups + [[ -e ${path} ]] && grep -qa docker "${path}" +} + # Stuff that we have to do inside Docker: -if grep -qa docker /proc/1/cgroups && [[ ${1} != "production" ]]; then +if in_docker && [[ ${1} != "production" ]]; then emerge --sync fi |