From a157f54f20721bc13256c70a432451838baca230 Mon Sep 17 00:00:00 2001 From: aptalca Date: Mon, 1 Apr 2019 10:44:33 -0400 Subject: [PATCH] fix permission logic --- README.md | 1 + readme-vars.yml | 1 + root/etc/cont-init.d/50-config | 6 ++++-- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 608fff5..07fe9af 100644 --- a/README.md +++ b/README.md @@ -174,6 +174,7 @@ Below are the instructions for updating containers: ## Versions +* **01.04.19:** - Fix permission detect logic. * **26.03.19:** - Install Heimdall during container start to prevent delayed start due to overlayfs bug with recursive chown. * **23.03.19:** - Switching to new Base images, shift to arm32v7 tag. * **15.03.19:** - Clarify docker image tags in readme. diff --git a/readme-vars.yml b/readme-vars.yml index 1f8483a..dd94a1a 100644 --- a/readme-vars.yml +++ b/readme-vars.yml @@ -49,6 +49,7 @@ app_setup_block: | # changelog changelogs: + - { date: "01.04.19:", desc: "Fix permission detect logic." } - { date: "26.03.19:", desc: "Install Heimdall during container start to prevent delayed start due to overlayfs bug with recursive chown." } - { date: "23.03.19:", desc: "Switching to new Base images, shift to arm32v7 tag." } - { date: "15.03.19:", desc: "Clarify docker image tags in readme." } diff --git a/root/etc/cont-init.d/50-config b/root/etc/cont-init.d/50-config index 014b1b5..09cab68 100644 --- a/root/etc/cont-init.d/50-config +++ b/root/etc/cont-init.d/50-config @@ -42,10 +42,11 @@ sed -i 's/QUEUE_DRIVER=sync/QUEUE_DRIVER=database/' /config/www/.env # function to randomly sample 5 files for their owner and only chown if not abc chowner () { -files=(${1}/*) -for i in {1..5}; do +files=(${1}/**) +for i in {1..50}; do user=$(stat -c '%U' $(printf "%s\n" "${files[RANDOM % ${#files[@]}]}")) if [ "${user}" != "abc" ]; then + echo "chowning /config" chown -R abc:abc ${1} break fi @@ -54,6 +55,7 @@ done # permissions echo "Setting permissions" +shopt -s globstar abc_dirs=( \ /config \ )