diff --git a/dev-setup.sh b/dev-setup.sh index e16fc8f..8b0f914 100755 --- a/dev-setup.sh +++ b/dev-setup.sh @@ -1,4 +1,9 @@ #!/usr/bin/env bash +set -ex + +command_exists() { type "$1" &>/dev/null; } + +./test.sh rm -rf ./data/ mkdir -p ./data/{fedora-repo,librewolf,other-workspace} @@ -6,8 +11,16 @@ mkdir -p ./data/{fedora-repo,librewolf,other-workspace} mkdir -p ./dev/{pgadmin,gregory-pg} chmod -R 777 ./dev/pgadmin -podman-compose down -podman-compose -f podman-compose.dev.yml up -d +if command_exists "docker-compose"; then + docker-compose -f podman-compose.dev.yml down + docker-compose -f podman-compose.dev.yml up -d +elif command_exists "podman-compose"; then + podman-compose -f podman-compose.dev.yml down + podman-compose -f podman-compose.dev.yml up -d +else + echo "[ERROR] neither docker-compose nor podman-compose were found" + exit 127 +fi echo " --- @@ -19,4 +32,4 @@ echo 'pgadmin login: echo 'pgadmin settings: Hostname: "postgres" Username: "gregory" - Password: "pass"' \ No newline at end of file + Password: "pass"' diff --git a/test.bash b/test.sh similarity index 94% rename from test.bash rename to test.sh index b9508e6..4a84160 100755 --- a/test.bash +++ b/test.sh @@ -1,4 +1,6 @@ #!/usr/bin/env bash +set -ex + # set env vars for testing export GREGORY_DB_ADDRESS=postgres export GREGORY_DB_USER=gregory