From 48a26c0db0cff050ab83dc6fc39f72e62939266b Mon Sep 17 00:00:00 2001 From: Derek Smith Date: Wed, 1 Feb 2023 16:11:50 -0500 Subject: [PATCH] 1 --- defaults.sh | 21 --------------------- deployment/check_environment.sh | 23 +++++++++++++++++++++++ deployment/deploy.sh | 1 + 3 files changed, 24 insertions(+), 21 deletions(-) create mode 100755 deployment/check_environment.sh diff --git a/defaults.sh b/defaults.sh index ac57a80..296d448 100755 --- a/defaults.sh +++ b/defaults.sh @@ -2,27 +2,6 @@ set -ex -if lxc remote get-default | grep -q "production"; then - echo "WARNING: You are running a migration procedure on a production system." - echo "" - - # check if there are any uncommited changes. It's dangerous to - # alter production systems when you have commits to make or changes to stash. - if git update-index --refresh | grep -q "needs update"; then - echo "ERROR: You have uncommited changes! You MUST commit or stash all changes to continue." - exit 1 - fi - - RESPONSE= - read -r -p " Are you sure you want to continue (y) ": RESPONSE - if [ "$RESPONSE" != "y" ]; then - echo "STOPPING." - exit 1 - fi - -fi - - export DEPLOY_WWW_SERVER=false export DEPLOY_GHOST=false diff --git a/deployment/check_environment.sh b/deployment/check_environment.sh new file mode 100755 index 0000000..911e510 --- /dev/null +++ b/deployment/check_environment.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +set -ex + +if lxc remote get-default | grep -q "production"; then + echo "WARNING: You are running a migration procedure on a production system." + echo "" + + # check if there are any uncommited changes. It's dangerous to + # alter production systems when you have commits to make or changes to stash. + if git update-index --refresh | grep -q "needs update"; then + echo "ERROR: You have uncommited changes! You MUST commit or stash all changes to continue." + exit 1 + fi + + RESPONSE= + read -r -p " Are you sure you want to continue (y) ": RESPONSE + if [ "$RESPONSE" != "y" ]; then + echo "STOPPING." + exit 1 + fi + +fi diff --git a/deployment/deploy.sh b/deployment/deploy.sh index 6ebea6c..8f37282 100755 --- a/deployment/deploy.sh +++ b/deployment/deploy.sh @@ -7,6 +7,7 @@ LATEST_GIT_COMMIT="$(cat ../.git/refs/heads/master)" export LATEST_GIT_COMMIT="$LATEST_GIT_COMMIT" ./check_dependencies.sh +./check_environment.sh DOMAIN_NAME= RUN_CERT_RENEWAL=true