diff --git a/files/entrypoint.sh b/files/entrypoint.sh index ea53f8e..3269b85 100755 --- a/files/entrypoint.sh +++ b/files/entrypoint.sh @@ -20,6 +20,20 @@ if [ -f /firstrun ]; then tar xf BackupPC-$BACKUPPC_VERSION.tar.gz cd /root/BackupPC-$BACKUPPC_VERSION + # Configure WEB UI access + configure_admin="" + if [ ! -f /etc/backuppc/htpasswd ]; then + htpasswd -b -c /etc/backuppc/htpasswd "${BACKUPPC_WEB_USER:-backuppc}" "${BACKUPPC_WEB_PASSWD:-password}" + + configure_admin="--config-override CgiAdminUsers='${BACKUPPC_WEB_USER:-backuppc}'" + + 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}" + + configure_admin="--config-override CgiAdminUsers='$BACKUPPC_WEB_USER'" + fi + # Install BackupPC (existing configuration will be reused and upgraded) perl configure.pl \ --batch \ @@ -30,16 +44,7 @@ if [ -f /firstrun ]; then --html-dir /var/www/html/BackupPC \ --html-dir-url /BackupPC \ --install-dir /usr/local/BackupPC \ - --config-override CgiAdminUsers="'${BACKUPPC_WEB_USER:-backuppc}'" - - # Configure WEB UI access - if [ ! -f /etc/backuppc/htpasswd ]; then - 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 + $configure_admin # Prepare lighttpd if [ "$USE_SSL" = true ]; then