-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbwctl.sh
executable file
·32 lines (27 loc) · 1008 Bytes
/
bwctl.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env bash
set -ef -o pipefail
readonly BASE_DIR="$(dirname "$(realpath "$0")")"
readonly BWCTL_HOME="$HOME/.bwctl"
# Terraform
if [[ ! -d "$BWCTL_HOME/terraform" ]]; then
mkdir -p "$BWCTL_HOME/terraform"
fi
# Purge templates and copy fresh
find "$BWCTL_HOME/terraform" -maxdepth 1 -mindepth 1 ! -type d -exec rm -rf {} \;
while read -r i; do
find "$i" -maxdepth 1 -mindepth 1 ! -name "\.terraform" ! -name "terraform.tfstate*" -exec rm -rf {} \;
done < <(find "$BWCTL_HOME/terraform" -maxdepth 1 -mindepth 1 -type d)
if [[ ! -d "./venv/" ]]; then
virtualenv --python=python3 venv
# shellcheck disable=SC1091
# motivation: ./venv/bin... does not exist before exec virtualenv
source ./venv/bin/activate
pip install --editable .
pip install --editable ../bwctl_resources
else
# shellcheck disable=SC1091
# motivation: ./venv/bin... does not exist before exec virtualenv
source ./venv/bin/activate
fi
#find . -name "*.pyc" -exec rm -f {} \;
bwctl "$@"