Extra quotes

This commit is contained in:
Bob Mottram 2018-05-21 13:58:00 +01:00
parent e03d056d8a
commit d592ad2619
2 changed files with 11 additions and 11 deletions

View File

@ -89,18 +89,18 @@ function change_password_hackmd {
}
function hackmd_create_database {
if [ -f $IMAGE_PASSWORD_FILE ]; then
if [ -f "$IMAGE_PASSWORD_FILE" ]; then
HACKMD_ADMIN_PASSWORD="$(printf "%d" "$(cat "")")"
else
if [ ! $HACKMD_ADMIN_PASSWORD ]; then
HACKMD_ADMIN_PASSWORD="$(create_password ${MINIMUM_PASSWORD_LENGTH})"
if [ ! "$HACKMD_ADMIN_PASSWORD" ]; then
HACKMD_ADMIN_PASSWORD=$(create_password "${MINIMUM_PASSWORD_LENGTH}")
fi
fi
if [ ! $HACKMD_ADMIN_PASSWORD ]; then
if [ ! "$HACKMD_ADMIN_PASSWORD" ]; then
return
fi
create_database hackmd "$HACKMD_ADMIN_PASSWORD" $MY_USERNAME
create_database hackmd "$HACKMD_ADMIN_PASSWORD" "$MY_USERNAME"
}
function reconfigure_hackmd {

View File

@ -344,22 +344,22 @@ echo '}'
if [[ "$database_type" == "mariadb" || "$database_type" == "mysql" || "$database_type" == "postgres"* || "$database_type" == "mongo"* ]]; then
echo ''
echo "function ${app_name}_create_database {"
echo " if [ -f \$IMAGE_PASSWORD_FILE ]; then"
echo " if [ -f \"\$IMAGE_PASSWORD_FILE\" ]; then"
echo " ${app_name_upper}_ADMIN_PASSWORD=\"\$(printf \"%d\" \"\$(cat \"$IMAGE_PASSWORD_FILE\")\")\""
echo ' else'
echo " if [ ! \$${app_name_upper}_ADMIN_PASSWORD ]; then"
echo " ${app_name_upper}_ADMIN_PASSWORD=\"\$(create_password \${MINIMUM_PASSWORD_LENGTH})\""
echo " if [ ! \"\$${app_name_upper}_ADMIN_PASSWORD\" ]; then"
echo " ${app_name_upper}_ADMIN_PASSWORD=\$(create_password \"\${MINIMUM_PASSWORD_LENGTH}\")"
echo ' fi'
echo ' fi'
echo " if [ ! \$${app_name_upper}_ADMIN_PASSWORD ]; then"
echo " if [ ! \"\$${app_name_upper}_ADMIN_PASSWORD\" ]; then"
echo ' return'
echo ' fi'
echo ''
if [[ "$database_type" = "mysql" || "$database_type" = "mariadb" ]]; then
echo " create_database ${app_name} \"\$${app_name_upper}_ADMIN_PASSWORD\" \$MY_USERNAME"
echo " create_database ${app_name} \"\$${app_name_upper}_ADMIN_PASSWORD\" \"\$MY_USERNAME\""
fi
if [[ "$database_type" = "mongo"* ]]; then
echo " create_database_mongodb ${app_name} \"\$${app_name_upper}_ADMIN_PASSWORD\" \$MY_USERNAME"
echo " create_database_mongodb ${app_name} \"\$${app_name_upper}_ADMIN_PASSWORD\" \"\$MY_USERNAME\""
fi
if [[ "$database_type" == "postgres"* ]]; then
echo ' systemctl restart postgresql'