diff --git a/README.md b/README.md index be26c291d..90ec5ded8 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ The latest image is available on DockerHub at [`listmonk/listmonk:latest`](https ```bash mkdir listmonk-demo && cd listmonk-demo -sh -c "$(curl -fsSL https://raw.githubusercontent.com/knadh/listmonk/master/install-demo.sh)" +bash -c "$(curl -fsSL https://raw.githubusercontent.com/knadh/listmonk/master/install-demo.sh)" ``` DO NOT use this demo setup in production. @@ -27,7 +27,7 @@ DO NOT use this demo setup in production. ```bash mkdir listmonk && cd listmonk -sh -c "$(curl -fsSL https://raw.githubusercontent.com/knadh/listmonk/master/install-prod.sh)" +bash -c "$(curl -fsSL https://raw.githubusercontent.com/knadh/listmonk/master/install-prod.sh)" ``` Visit `http://localhost:9000`. diff --git a/docs/docs/content/installation.md b/docs/docs/content/installation.md index 7eb526a2a..0ba17212c 100644 --- a/docs/docs/content/installation.md +++ b/docs/docs/content/installation.md @@ -26,7 +26,7 @@ Use the sample [docker-compose.yml](https://github.com/knadh/listmonk/blob/maste ```bash mkdir listmonk-demo && cd listmonk-demo -sh -c "$(curl -fsSL https://raw.githubusercontent.com/knadh/listmonk/master/install-demo.sh)" +bash -c "$(curl -fsSL https://raw.githubusercontent.com/knadh/listmonk/master/install-demo.sh)" ``` #### Manual Docker install @@ -47,7 +47,7 @@ This setup is recommended if you want to _quickly_ setup `listmonk` in productio ```bash mkdir listmonk && cd listmonk -sh -c "$(curl -fsSL https://raw.githubusercontent.com/knadh/listmonk/master/install-prod.sh)" +bash -c "$(curl -fsSL https://raw.githubusercontent.com/knadh/listmonk/master/install-prod.sh)" ``` The above shell script performs the following actions: diff --git a/install-demo.sh b/install-demo.sh index 5563b641e..953be4742 100755 --- a/install-demo.sh +++ b/install-demo.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env sh +#!/usr/bin/env bash set -eu # Listmonk demo setup using `docker compose`. diff --git a/install-prod.sh b/install-prod.sh index 9ebc5d5bd..0a1fa477d 100755 --- a/install-prod.sh +++ b/install-prod.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env sh +#!/usr/bin/env bash set -eu # Listmonk production setup using `docker compose`. @@ -10,7 +10,6 @@ RED="$(tput setaf 1 2>/dev/null || printf '')" BLUE="$(tput setaf 4 2>/dev/null || printf '')" GREEN="$(tput setaf 2 2>/dev/null || printf '')" NO_COLOR="$(tput sgr0 2>/dev/null || printf '')" -SED_INPLACE=$(if [[ "$(uname)" == "Darwin" ]]; then echo "-i ''"; else echo "-i"; fi) info() { printf '%s\n' "${BLUE}> ${NO_COLOR} $*" @@ -25,7 +24,18 @@ completed() { } exists() { - command -v "$1" 1>/dev/null 2>&1 + command -v "$1" >/dev/null 2>&1 +} + +sed_inplace() { + local search_pattern="$1" + local replacement="$2" + local file="$3" + if [[ "$(uname)" == "Darwin" ]]; then + sed -i '' "s/${search_pattern}/${replacement}/g" "$file" + else + sed -i "s/${search_pattern}/${replacement}/g" "$file" + fi } check_dependencies() { @@ -40,7 +50,7 @@ check_dependencies() { fi # Check for "docker compose" functionality. - if ! docker compose version > /dev/null 2>&1; then + if ! docker compose version >/dev/null 2>&1; then echo "'docker compose' functionality is not available. Please update to a newer version of Docker. See https://docs.docker.com/engine/install/ for more details." exit 1 fi @@ -69,7 +79,7 @@ is_healthy() { } is_running() { - info "checking if "$1" is running" + info "checking if $1 is running" status="$(docker inspect -f "{{.State.Status}}" "$1")" if [ "$status" = "running" ]; then return 0 @@ -79,7 +89,7 @@ is_running() { } generate_password(){ - echo $(LC_ALL=C tr -dc A-Za-z0-9