Update script so we don't keep deleting and re-cloning for no reason
This commit is contained in:
@@ -6,12 +6,17 @@ cd /home/ansible
|
||||
# Ensure we have a log dir
|
||||
mkdir -p /home/ansible/logs
|
||||
|
||||
# Cleanup
|
||||
rm -rf /home/ansible/infra
|
||||
rm -rf /home/ansible/venv
|
||||
|
||||
# Clone the infra repo
|
||||
git clone git@git.jthan.io:jonathan/infra /home/ansible/infra
|
||||
cd /home/ansible/infra
|
||||
git fetch origin > /dev/null 2>&1
|
||||
|
||||
BEHIND_COUNT=$(git rev-list --count HEAD..@{u})
|
||||
|
||||
if [ "$BEHIND_COUNT" -gt 0 ]; then
|
||||
git pull
|
||||
else
|
||||
echo "Local branch is up to date with the remote, no changes."
|
||||
fi
|
||||
|
||||
# Create a venv
|
||||
python3 -m venv /home/ansible/venv
|
||||
|
||||
Reference in New Issue
Block a user