diff --git a/scripts/_var_lib_git_gogs-repositories_bryan_www.git_hooks_post-receive.sh b/scripts/_var_lib_git_gogs-repositories_bryan_www.git_hooks_post-receive.sh index d2ba41a..6742ee9 100644 --- a/scripts/_var_lib_git_gogs-repositories_bryan_www.git_hooks_post-receive.sh +++ b/scripts/_var_lib_git_gogs-repositories_bryan_www.git_hooks_post-receive.sh @@ -4,11 +4,11 @@ GIT_DIR="$(pwd)" 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}" - cd "${TMP_GIT_DIR}" + cd "${TMP_GIT_DIR}" || exit $? else - cd "${TMP_GIT_DIR}" + cd "${TMP_GIT_DIR}" || exit $? unset GIT_DIR git fetch --all git reset --hard origin/master @@ -16,12 +16,16 @@ else fi for site in *.*/; do - [ ! -d /var/www/${site} ] && mkdir -p /var/www/${site} && chgrp -R /var/www/${site} && chmod g+s /var/www/${site} - pushd ${site} - bundle install --deployment - bundle exec jekyll build --destination /var/www/${site} - popd + deploy_dir="/var/www/${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 exec jekyll build --destination "$deploy_dir" + popd || exit $? done - -exit +exit 0