diff --git a/setup b/setup index 5689796..fda6d75 100755 --- a/setup +++ b/setup @@ -1,39 +1,39 @@ #!/bin/bash -echo '####################################################################' -echo '# docker_postgres_setup_script #' -echo '# Dennis Buchhorn - bucde@b-eit.de #' -echo '####################################################################' -echo '# WARNING: password is plain text input! #' -echo '# #' +echo "####################################################################" +echo "# docker_postgres_setup_script #" +echo "# Dennis Buchhorn - bucde@b-eit.de #" +echo "####################################################################" +echo "# WARNING: password is plain text input! #" +echo "# #" echo "# Config will be saved in '.env' file. #" -echo '# (everything in plain text, even the password) #' -#echo '# #' -echo '####################################################################' -echo '' +echo "# (everything in plain text, even the password) #" +#echo "# #" +echo "####################################################################" +echo "" -CONFIG_EXISTS='false' -KEEP_CONFIG='' +CONFIG_EXISTS="false" +KEEP_CONFIG="" -POSTGRES_VERSION='' -POSTGRES_HOST_IP_ADDRESS='' -POSTGRES_HOST_PORT='' -POSTGRES_ADMIN_USER='' -POSTGRES_ADMIN_PASSWORD='' +POSTGRES_VERSION="" +POSTGRES_HOST_IP_ADDRESS="" +POSTGRES_HOST_PORT="" +POSTGRES_ADMIN_USER="" +POSTGRES_ADMIN_PASSWORD="" -POSTGRES_SHARED_HOSTING='' +POSTGRES_SHARED_HOSTING="" if [ -f ".env" ]; then - CONFIG_EXISTS='true' + CONFIG_EXISTS="true" read -p "Config file '.env' already exists! Would you like to use this? (y/n)" KEEP_CONFIG fi -if [ $CONFIG_EXISTS == 'false' ] || [ $KEEP_CONFIG == 'n' ]; then - read -p 'Enter postgres version which should be used: ' POSTGRES_VERSION - read -p 'Enter host (vm) ip address on which postgres should be accessible: ' POSTGRES_HOST_IP_ADDRESS - read -p 'Enter host (vm) port on which postgres should be accessible: ' POSTGRES_HOST_PORT - read -p 'Enter admin user name for postgres: ' POSTGRES_ADMIN_USER - read -p 'Enter admin password for postgres: ' POSTGRES_ADMIN_PASSWORD +if [ $CONFIG_EXISTS == "false" ] || [ $KEEP_CONFIG == "n" ]; then + read -p "Enter postgres version which should be used: " POSTGRES_VERSION + read -p "Enter host (vm) ip address on which postgres should be accessible: " POSTGRES_HOST_IP_ADDRESS + read -p "Enter host (vm) port on which postgres should be accessible: " POSTGRES_HOST_PORT + read -p "Enter admin user name for postgres: " POSTGRES_ADMIN_USER + read -p "Enter admin password for postgres: " POSTGRES_ADMIN_PASSWORD rm -f .env touch .env @@ -50,15 +50,15 @@ else done < ".env" fi -read -p 'Would you like to modify postgres rights for shared hosting? (y/n)' POSTGRES_SHARED_HOSTING +read -p "Would you like to modify postgres rights for shared hosting? (y/n)" POSTGRES_SHARED_HOSTING docker-compose up -d -echo 'Wait a few seconds for the container to spin up ...' +echo "Wait a few seconds for the container to spin up ..." sleep 5 -if [ $POSTGRES_SHARED_HOSTING == 'y' ]; then +if [ $POSTGRES_SHARED_HOSTING == "y" ]; then touch tmp echo "REVOKE ALL ON DATABASE template1 FROM public;" >> tmp echo "REVOKE ALL ON SCHEMA public FROM public;" >> tmp @@ -77,4 +77,4 @@ if [ $POSTGRES_SHARED_HOSTING == 'y' ]; then rm -f tmp fi -echo 'Done!' +echo "Done!"