Update post-receive hook script

This commit is contained in:
2020-03-13 10:00:21 -04:00
parent 6ae98229a9
commit 03b1610cfd

View File

@@ -4,11 +4,11 @@
GIT_DIR="$(pwd)" GIT_DIR="$(pwd)"
TMP_GIT_DIR="/tmp/${GIT_DIR##*/}" TMP_GIT_DIR="/tmp/${GIT_DIR##*/}"
if [ ! -d "${TMP_GIT_DIR}" ]; then if [[ ! -d "${TMP_GIT_DIR}" ]]; then
git clone "${GIT_DIR}" "${TMP_GIT_DIR}" git clone "${GIT_DIR}" "${TMP_GIT_DIR}"
cd "${TMP_GIT_DIR}" cd "${TMP_GIT_DIR}" || exit $?
else else
cd "${TMP_GIT_DIR}" cd "${TMP_GIT_DIR}" || exit $?
unset GIT_DIR unset GIT_DIR
git fetch --all git fetch --all
git reset --hard origin/master git reset --hard origin/master
@@ -16,12 +16,16 @@ else
fi fi
for site in *.*/; do for site in *.*/; do
[ ! -d /var/www/${site} ] && mkdir -p /var/www/${site} && chgrp -R /var/www/${site} && chmod g+s /var/www/${site} deploy_dir="/var/www/${site}"
pushd ${site} if [[ ! -d "$deploy_dir" ]]; then
mkdir -p "$deploy_dir"
chgrp -R "$deploy_dir"
chmod g+s "$deploy_dir"
fi
pushd "${site}" || exit $?
bundle install --deployment bundle install --deployment
bundle exec jekyll build --destination /var/www/${site} bundle exec jekyll build --destination "$deploy_dir"
popd popd || exit $?
done done
exit 0
exit