From c303819d5a17335775de54151ea5e3c7dc17320d Mon Sep 17 00:00:00 2001 From: Elisabeth Kulzer Date: Fri, 16 Jul 2021 11:32:50 +0200 Subject: [PATCH] Address changes requested. --- scripts/issue-certificate.sh | 12 ++++++------ scripts/upgrade-from-mattermost-docker.sh | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/scripts/issue-certificate.sh b/scripts/issue-certificate.sh index 8b35621..aa82e26 100755 --- a/scripts/issue-certificate.sh +++ b/scripts/issue-certificate.sh @@ -16,12 +16,12 @@ issue_cert_standalone() { docker run -it --rm --name certbot -p 80:80 \ -v "${1}/etc/letsencrypt:/etc/letsencrypt" \ -v "${1}/lib/letsencrypt:/var/lib/letsencrypt" \ - certbot/certbot certonly --standalone -d ${2} + certbot/certbot certonly --standalone -d "${2}" } authenticator_to_webroot() { - sed -i 's/standalone/webroot/' ${1}/etc/letsencrypt/renewal/${2}.conf - tee -a ${1}/etc/letsencrypt/renewal/${2}.conf >/dev/null </dev/null </dev/null); then +if ! which docker 1>/dev/null; then echo "Can't find Docker command" >&2 exit 64 fi -issue_cert_standalone ${output} ${domain} -authenticator_to_webroot ${output} ${domain} +issue_cert_standalone "${output}" "${domain}" +authenticator_to_webroot "${output}" "${domain}" diff --git a/scripts/upgrade-from-mattermost-docker.sh b/scripts/upgrade-from-mattermost-docker.sh index 30c5587..2d43c84 100755 --- a/scripts/upgrade-from-mattermost-docker.sh +++ b/scripts/upgrade-from-mattermost-docker.sh @@ -14,9 +14,9 @@ set -o errexit # This may take some time to complete as it's migrating the database to Postgres 13.6 from 9.4 -PATH_TO_MATTERMOST_DOCKER=$PATH_TO_MATTERMOST_DOCKER # i.e. $PWD if [[ $PATH_TO_MATTERMOST_DOCKER == "" ]]; then - echo "Please export environment variable PATH_TO_MATTERMOST_DOCKER with '$ export PATH_TO_MATTERMOST_DOCKER=/path/to/mattermost-docker' before running this script. " + # shellcheck disable=SC2016 + echo 'Please export environment variable PATH_TO_MATTERMOST_DOCKER with "$ export PATH_TO_MATTERMOST_DOCKER=/path/to/mattermost-docker", i.e. $PWD before running this script. ' exit 1 fi @@ -27,7 +27,7 @@ fi # The script is trying to fetch those variables first. Should fetching fail, please export the variables before running the script. if [[ $POSTGRES_USER == "" ]]; then echo "trying to fetch POSTGRES_USER from $PATH_TO_MATTERMOST_DOCKER/docker-compose.yml" - POSTGRES_USER=$(echo "$(grep "^.*-.*POSTGRES_USER=.*$" "$PATH_TO_MATTERMOST_DOCKER"/docker-compose.yml)" | sed s~^.*-.*POSTGRES_USER=~~g) + POSTGRES_USER=$(grep "^.*-.*POSTGRES_USER=.*$" "$PATH_TO_MATTERMOST_DOCKER"/docker-compose.yml | sed s~^.*-.*POSTGRES_USER=~~g) if [[ $POSTGRES_USER == "" ]]; then echo "could not find POSTGRES_USER set in $PATH_TO_MATTERMOST_DOCKER/docker-compose.yml" echo "please run 'export POSTGRES_USER=yourPostgresUser' before running this script" @@ -38,7 +38,7 @@ fi if [[ $POSTGRES_PASSWORD == "" ]]; then echo "trying to fetch POSTGRES_PASSWORD from $PATH_TO_MATTERMOST_DOCKER/docker-compose.yml" - POSTGRES_PASSWORD=$(echo "$(grep "^.*-.*POSTGRES_PASSWORD=.*$" "$PATH_TO_MATTERMOST_DOCKER"/docker-compose.yml)" | sed s~^.*-.*POSTGRES_PASSWORD=~~g) + POSTGRES_PASSWORD=$(grep "^.*-.*POSTGRES_PASSWORD=.*$" "$PATH_TO_MATTERMOST_DOCKER"/docker-compose.yml | sed s~^.*-.*POSTGRES_PASSWORD=~~g) if [[ $POSTGRES_PASSWORD == "" ]]; then echo "could not find POSTGRES_PASSWORD set in $PATH_TO_MATTERMOST_DOCKER/docker-compose.yml" echo "please run 'export POSTGRES_PASSWORD=yourPostgresPassword' before running this script" @@ -49,7 +49,7 @@ fi if [[ $POSTGRES_DB == "" ]]; then echo "trying to fetch POSTGRES_DB from $PATH_TO_MATTERMOST_DOCKER/docker-compose.yml" - POSTGRES_DB=$(echo "$(grep "^.*-.*POSTGRES_DB=.*$" "$PATH_TO_MATTERMOST_DOCKER"/docker-compose.yml)" | sed s~^.*-.*POSTGRES_DB=~~g) + POSTGRES_DB=$(grep "^.*-.*POSTGRES_DB=.*$" "$PATH_TO_MATTERMOST_DOCKER"/docker-compose.yml | sed s~^.*-.*POSTGRES_DB=~~g) if [[ $POSTGRES_DB == "" ]]; then echo "could not find POSTGRES_DB set in $PATH_TO_MATTERMOST_DOCKER/docker-compose.yml" echo "please run 'export POSTGRES_DB=yourPostgresDatabase' before running this script" @@ -113,7 +113,7 @@ fi printf "\n" if [[ $MM_OLD_VERSION == "" ]]; then echo "trying to fetch MM_OLD_VERSION from $PATH_TO_MATTERMOST_DOCKER/docker-compose.yml" - MM_OLD_VERSION=$(echo "$(grep ".*-.*MM_VERSION=.*" "$PATH_TO_MATTERMOST_DOCKER"/docker-compose.yml)" | sed s~.*-.*MM_VERSION=~~g) + MM_OLD_VERSION=$(grep ".*-.*MM_VERSION=.*" "$PATH_TO_MATTERMOST_DOCKER"/docker-compose.yml | sed s~.*-.*MM_VERSION=~~g) if [[ $MM_OLD_VERSION == "" ]]; then echo "could not find MM_OLD_VERSION set in $PATH_TO_MATTERMOST_DOCKER/docker-compose.yml" echo "please run 'export MM_OLD_VERSION=yourMMVersion' before running this script"