1
1
sovereign-stack/deployment/check_environment.sh

24 lines
679 B
Bash
Raw Normal View History

2023-02-01 21:11:50 +00:00
#!/bin/bash
set -ex
if lxc remote get-default | grep -q "production"; then
2023-02-01 21:16:59 +00:00
echo "WARNING: You are running command against a production system!"
2023-02-01 21:11:50 +00:00
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