From e36431ef83b86c1b5e56716074f447ae830dd984 Mon Sep 17 00:00:00 2001 From: Konstantin Dmitriev Date: Tue, 29 Jan 2019 12:21:42 +0700 Subject: [PATCH] Do not create default user if BACKUPPC_WEB_USER is empty --- files/entrypoint.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/files/entrypoint.sh b/files/entrypoint.sh index 13e0ab3..a717f9e 100755 --- a/files/entrypoint.sh +++ b/files/entrypoint.sh @@ -32,8 +32,14 @@ if [ -f /firstrun ]; then --install-dir /usr/local/BackupPC # Configure WEB UI access - sed -ie "s/^\$Conf{CgiAdminUsers}\s*=\s*'\w*'/\$Conf{CgiAdminUsers} = '${BACKUPPC_WEB_USER:-backuppc}'/g" /etc/backuppc/config.pl - htpasswd -b -c /etc/backuppc/htpasswd ${BACKUPPC_WEB_USER:-backuppc} ${BACKUPPC_WEB_PASSWD:-password} + if [ ! -f /etc/backuppc/htpasswd ]; then + htpasswd -b -c /etc/backuppc/htpasswd ${BACKUPPC_WEB_USER:-backuppc} ${BACKUPPC_WEB_PASSWD:-password} + sed -ie "s/^\$Conf{CgiAdminUsers}\s*=\s*'\w*'/\$Conf{CgiAdminUsers} = '${BACKUPPC_WEB_USER:-backuppc}'/g" /etc/backuppc/config.pl + 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}" + sed -ie "s/^\$Conf{CgiAdminUsers}\s*=\s*'\w*'/\$Conf{CgiAdminUsers} = '${BACKUPPC_WEB_USER:-backuppc}'/g" /etc/backuppc/config.pl + fi # Prepare lighttpd if [ "$USE_SSL" = true ]; then