diff --git a/src/freedombone-app-hackmd b/src/freedombone-app-hackmd index c2a50e91..253d348b 100755 --- a/src/freedombone-app-hackmd +++ b/src/freedombone-app-hackmd @@ -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 { diff --git a/src/freedombone-template b/src/freedombone-template index ba45ebbf..ce334fd4 100755 --- a/src/freedombone-template +++ b/src/freedombone-template @@ -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'