From ad098a6aab02f5cc808b0ecafa124b0cfb46e7de Mon Sep 17 00:00:00 2001 From: Alexandre Roman Date: Sat, 13 Oct 2018 10:07:27 +0200 Subject: [PATCH] fix container initialization When using this Docker image with volume mounting on managed environments (such as K8s), the directory '/usr/local/share/moin/data' is not empty since it may contain the directory 'lost+found'. Container initilization fails because the startup script expects the data directory to be empty. In order to fix this bug, the script now checks for the presence of file 'initialized', which is only created if the data directory is fully initialiazed. --- start.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/start.sh b/start.sh index c0d8fdd..b787c47 100755 --- a/start.sh +++ b/start.sh @@ -1,10 +1,11 @@ #!/usr/bin/env sh -# If the data folder is empty it is most likely because +# If the data folder does not contain file 'initialized' it is most likely because # the container is fresh and has been started with # the volume option -if ! [ "$(ls -A /usr/local/share/moin/data)" ]; then +if ! [ "$(ls -A /usr/local/share/moin/data/initialized 2>/dev/null)" ]; then cp -r /usr/local/share/moin/bootstrap-data/* /usr/local/share/moin/data/ + touch /usr/local/share/moin/data/initialized chown -R www-data:www-data /usr/local/share/moin/data fi