aboutsummaryrefslogtreecommitdiffhomepage
path: root/entrypoint.sh
diff options
context:
space:
mode:
Diffstat (limited to 'entrypoint.sh')
-rw-r--r--entrypoint.sh23
1 files changed, 13 insertions, 10 deletions
diff --git a/entrypoint.sh b/entrypoint.sh
index f1a8c22..eba1cb2 100644
--- a/entrypoint.sh
+++ b/entrypoint.sh
@@ -1,15 +1,18 @@
1#!/bin/sh 1#!/bin/sh
2 2
3# Ensure default assets are present. 3PERMISSION_ERROR="Check assets directory permissions & docker user or skip default assets install by setting the INIT_ASSETS env var to 0"
4while true; do echo n; done | cp -Ri /www/default-assets/* /www/assets/ &> /dev/null
5 4
6# Ensure compatibility with previous version (config.yml was in the root directory) 5# Default assets & exemple configuration installation if possible.
7if [ -f "/www/config.yml" ]; then 6if [[ "${INIT_ASSETS}" == "1" ]] && [[ ! -f "/www/config.yml" ]]; then
8 yes n | cp -i /www/config.yml /www/assets/ &> /dev/null 7 echo "No configuration found, installing default config & assets"
9fi 8 if [[ ! -w "/www/assets/" ]]; then echo "Assets directory not writable. $PERMISSION_ERROR" && exit 1; fi
9
10 while true; do echo n; done | cp -Ri /www/default-assets/* /www/assets/ &> /dev/null
11 if [[ $? -ne 0 ]]; then echo "Fail to copy default assets. $PERMISSION_ERROR" && exit 1; fi
10 12
11# Install default config if no one is available. 13 yes n | cp -i /www/default-assets/config.yml.dist /www/assets/config.yml &> /dev/null
12yes n | cp -i /www/default-assets/config.yml.dist /www/assets/config.yml &> /dev/null 14 if [[ $? -ne 0 ]]; then echo "Fail to copy default config file. $PERMISSION_ERROR" && exit 1; fi
15fi
13 16
14chown -R $UID:$GID /www/assets 17echo "Starting webserver"
15exec su-exec $UID:$GID darkhttpd /www/ --no-listing --port "$PORT" 18lighttpd -D -f /lighttpd.conf