File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55set -eo pipefail
66
77SCRIPT_DIR=" $( cd " $( dirname " $0 " ) " && pwd) "
8+ REPO_ROOT=" $( cd " $SCRIPT_DIR /.." && pwd) "
9+ TUTS_DIR=" $REPO_ROOT /tuts"
810PREREQ_STACK=" tutorial-prereqs"
911
1012if [ " $1 " = " --prereqs" ]; then
6567TUT_DIR=" $1 "
6668[ -z " $TUT_DIR " ] && echo " Usage: $0 <tutorial-dir> | --prereqs" && exit 1
6769
70+ # Prereq tutorials have their own cleanup scripts
71+ if [[ " $TUT_DIR " == 000-prereqs-* ]]; then
72+ CLEANUP_SCRIPT=" $TUTS_DIR /$TUT_DIR /$( ls " $TUTS_DIR /$TUT_DIR /" | grep cleanup | head -1) "
73+ if [ -f " $CLEANUP_SCRIPT " ]; then
74+ echo " Running prereq cleanup: $CLEANUP_SCRIPT "
75+ bash " $CLEANUP_SCRIPT "
76+ exit $?
77+ fi
78+ fi
79+
6880STACK_NAME=" tutorial-$( echo " $TUT_DIR " | sed ' s/^[0-9]*-//' ) "
6981
7082# Check if stack exists
Original file line number Diff line number Diff line change @@ -27,6 +27,16 @@ TUT_DIR="$1"
2727shift
2828OVERRIDES=" $@ "
2929
30+ # Prereq tutorials have their own deploy scripts
31+ if [[ " $TUT_DIR " == 000-prereqs-* ]]; then
32+ DEPLOY_SCRIPT=" $TUTS_DIR /$TUT_DIR /$( ls " $TUTS_DIR /$TUT_DIR /" | grep -v cleanup | grep -v cfn | grep -v README | grep -v REVISION | grep ' \.sh$' | head -1) "
33+ if [ -f " $DEPLOY_SCRIPT " ]; then
34+ echo " Running prereq deploy script: $DEPLOY_SCRIPT "
35+ bash " $DEPLOY_SCRIPT "
36+ exit $?
37+ fi
38+ fi
39+
3040# Find the template
3141TEMPLATE=$( find " $TUTS_DIR /$TUT_DIR " -name ' cfn-*.yaml' -o -name ' cfn-*.yml' 2> /dev/null | head -1)
3242if [ -z " $TEMPLATE " ]; then
You can’t perform that action at this time.
0 commit comments