From 7e5466e2bc9f76eea84ff696d4c56bb170406e33 Mon Sep 17 00:00:00 2001 From: Max Erenberg Date: Sun, 27 Nov 2022 15:00:07 -0500 Subject: [PATCH] always remove tmpdir in deploy.sh (#530) This change ensures that the temporary directory created by `mkdir --directory` is always removed when `deploy.sh` exits, whether or not the script succeeded. It also modifies the `git clone` command to use the `file://` protocol instead of HTTPS, to speed up the download. Reviewed-on: https://git.csclub.uwaterloo.ca/www/www-new/pulls/530 Reviewed-by: Shahan Nedadahandeh Co-authored-by: Max Erenberg Co-committed-by: Max Erenberg --- deploy.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/deploy.sh b/deploy.sh index f07dfeb2..fb92a570 100755 --- a/deploy.sh +++ b/deploy.sh @@ -4,12 +4,14 @@ set -ex ulimit -u 512 DIR=$(mktemp --directory) +trap "rm -rf $DIR" EXIT + # set USE_LDAP to true to generate member list using LDAP database export USE_LDAP=true pushd $DIR -git clone https://git.csclub.uwaterloo.ca/www/www-new.git --depth=1 +git clone file:///srv/git/www/www-new.git --depth=1 cd www-new @@ -26,5 +28,3 @@ rm -rf /srv/www-csc/* mv out/* /srv/www-csc/ popd - -rm -rf $DIR