From 7b994d5fefb81bb0dceca5c93a730614225bbd8e Mon Sep 17 00:00:00 2001 From: Christoph Roeder Date: Thu, 8 Jun 2017 14:50:09 +0200 Subject: [PATCH] keep htpasswd if no env vars given and create a new one when not exist --- files/entrypoint.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/files/entrypoint.sh b/files/entrypoint.sh index 049b205..ea53f8e 100755 --- a/files/entrypoint.sh +++ b/files/entrypoint.sh @@ -34,7 +34,11 @@ if [ -f /firstrun ]; then # Configure WEB UI access if [ ! -f /etc/backuppc/htpasswd ]; then - htpasswd -b -c /etc/backuppc/htpasswd ${BACKUPPC_WEB_USER:-backuppc} ${BACKUPPC_WEB_PASSWD:-password} + htpasswd -b -c /etc/backuppc/htpasswd "${BACKUPPC_WEB_USER:-backuppc}" "${BACKUPPC_WEB_PASSWD:-password}" + + elif [ -n "$BACKUPPC_WEB_USER" -a -n "$BACKUPPC_WEB_PASSWD" ]; then + touch /etc/backuppc/htpasswd + htpasswd -b /etc/backuppc/htpasswd "${BACKUPPC_WEB_USER}" "${BACKUPPC_WEB_PASSWD}" fi # Prepare lighttpd