From 41217edbfcfd2d8cf6a8f224a363293c72bd6387 Mon Sep 17 00:00:00 2001 From: Lachlan Glen <54282009+lachlanglen@users.noreply.github.com> Date: Fri, 31 May 2024 18:50:52 -0400 Subject: [PATCH] add clean_destination scripts --- appspec-dev.yml | 2 +- appspec-testnet.yml | 4 ++++ scripts/clean_destination_dev.sh | 8 ++++++++ scripts/clean_destination_testnet.sh | 8 ++++++++ 4 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 scripts/clean_destination_dev.sh create mode 100644 scripts/clean_destination_testnet.sh diff --git a/appspec-dev.yml b/appspec-dev.yml index 02a6c66..f83a7fc 100644 --- a/appspec-dev.yml +++ b/appspec-dev.yml @@ -5,7 +5,7 @@ files: destination: /home/ec2-user/django-indexer-dev hooks: BeforeInstall: - - location: "echo 'Cleaning up destination directory' && rm -rf /home/ec2-user/django-indexer-dev/*" + - location: scripts/clean_destination_dev.sh timeout: 300 runas: ec2-user AfterInstall: diff --git a/appspec-testnet.yml b/appspec-testnet.yml index b006f0e..3ed0e62 100644 --- a/appspec-testnet.yml +++ b/appspec-testnet.yml @@ -5,6 +5,10 @@ files: destination: /home/ec2-user/django-indexer-testnet hooks: # # Install: + BeforeInstall: + - location: scripts/clean_destination_testnet.sh + timeout: 300 + runas: ec2-user AfterInstall: - location: scripts/after_install_testnet.sh timeout: 300 diff --git a/scripts/clean_destination_dev.sh b/scripts/clean_destination_dev.sh new file mode 100644 index 0000000..638c035 --- /dev/null +++ b/scripts/clean_destination_dev.sh @@ -0,0 +1,8 @@ +#!/bin/bash +# Directory to clean +DEST_DIR="/home/ec2-user/django-indexer-dev" + +# Delete all contents of the destination directory +if [ -d "$DEST_DIR" ]; then + rm -rf "${DEST_DIR:?}/*" +fi \ No newline at end of file diff --git a/scripts/clean_destination_testnet.sh b/scripts/clean_destination_testnet.sh new file mode 100644 index 0000000..62b020a --- /dev/null +++ b/scripts/clean_destination_testnet.sh @@ -0,0 +1,8 @@ +#!/bin/bash +# Directory to clean +DEST_DIR="/home/ec2-user/django-indexer-testnet" + +# Delete all contents of the destination directory +if [ -d "$DEST_DIR" ]; then + rm -rf "${DEST_DIR:?}/*" +fi \ No newline at end of file