diff --git a/ab-openldap/ab-openldap.sh b/ab-openldap/ab-openldap.sh index ecb897c..ad12ccd 100755 --- a/ab-openldap/ab-openldap.sh +++ b/ab-openldap/ab-openldap.sh @@ -2,7 +2,7 @@ # ### start openldap container using params file variables -# version 3.0 +# version 3.1 # @@ -192,10 +192,8 @@ done ### process main operations -# automatically restore backups using a temporary container to create necessary -# volumes if [ $restore = true ]; then - # restore backup + # automatically restore backups using a temp container to create volumes printf "%s\n*** Restoring Backup ***\n\n%s" "$magenta" "$norm" printf "To avoid errors due to existing files, this script will delete any volumes that have the following names (based on --data and --ldif):\n" printf "\t%s\n\t%s\n" "$volume_data" "$volume_ldif" @@ -204,6 +202,7 @@ if [ $restore = true ]; then # delete any conflicting volumes docker volume rm -f ${volume_data} > /dev/null 2>&1 docker volume rm -f ${volume_ldif} > /dev/null 2>&1 + # run temporary container to merge backup data into volumes docker run --rm \ -v "$volume_data":/var/openldap/data \ @@ -212,8 +211,9 @@ if [ $restore = true ]; then docker.asifbacchus.app/ldap/ab-openldap:${tag} \ cat /var/openldap/data/restore.log printf "\nPlease review the log output on your screen to determine if the restore was successful or what errors need to be corrected. If everything was successful, your data volumes can be used in a new container started normally.\n" -# run without TLS -elif [ -z "$TLS_CERT" ]; then + +elif [ -z "$TLS_CERT" ]; then + # run container without TLS if [ $shell = true ]; then # exec shell printf "%s\nRunning SHELL on %s...%s\n" \ @@ -279,8 +279,9 @@ elif [ -z "$TLS_CERT" ]; then fi fi fi -# run with TLS + elif [ "$TLS_CERT" ] && [ "$TLS_KEY" ] && [ "$TLS_CHAIN" ]; then + # run container with TLS # verify certificate files exist if [ "$TLS_CERT" ]; then if [ ! -f "$TLS_CERT" ]; then @@ -293,7 +294,6 @@ elif [ "$TLS_CERT" ] && [ "$TLS_KEY" ] && [ "$TLS_CHAIN" ]; then consoleError '5' 'Cannot find specified TLS certificate chain file.' fi fi - if [ $shell = true ]; then # exec shell printf "%s\nRunning SHELL on %s (TLS)...%s\n" \