diff options
author | Aaron Ball <nullspoon@oper.io> | 2024-10-26 22:51:11 -0600 |
---|---|---|
committer | Aaron Ball <nullspoon@oper.io> | 2024-10-26 22:51:11 -0600 |
commit | 2835de6533fc8bdd7d737675969060fbdd1504a5 (patch) | |
tree | 35c516006419a710e1fb138d113762480f43bd0e | |
parent | c637dbb50746b04435e5c256ca1b923b1360efa9 (diff) | |
download | motd.sh-master.tar.gz motd.sh-master.tar.xz |
-rwxr-xr-x | hooks/post-receive | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/hooks/post-receive b/hooks/post-receive index 8022e90..bcba4a6 100755 --- a/hooks/post-receive +++ b/hooks/post-receive @@ -4,6 +4,7 @@ set -euo pipefail deploy() { local path="${1}" + local -i compile=0 # Deploy any pages that were changed for i in ${FILES_E[*]} ${FILES_A[*]} ${FILES_M[*]}; do @@ -22,7 +23,9 @@ deploy() { "$(date '+%F %T %Z')" >> "${dest}" elif [ "${i%%/*}" = 'src' ]; then - (cd src && make && make install DEPLOYDIR="${path}") + # Set compile = 1 and compile after parsing all files, or compilation + # will happen once per changed file in src. + compile=1 # Skip processing the hooks dir elif [ "${i%%/*}" = 'hooks' ]; then @@ -34,6 +37,10 @@ deploy() { fi done + # Compile if required + if [ "${compile:-0}" = 1 ]; then + (cd src && make && make install DEPLOYDIR="${path}") + fi } cleanup() { |