diff options
Diffstat (limited to 'post-receive.cyrax-build')
-rwxr-xr-x | post-receive.cyrax-build | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/post-receive.cyrax-build b/post-receive.cyrax-build index a564c79..fcb816d 100755 --- a/post-receive.cyrax-build +++ b/post-receive.cyrax-build @@ -8,18 +8,20 @@ while read old new ref ; do if [ "$BRANCH" = "master" ]; then TARGET_DIR="${WEB_BASE}/www.spline.de/htdocs/" URL="http://www.spline.de/" + RELATIVE="" else TARGET_DIR="${WEB_BASE}/branches.spline.de/htdocs/" URL="http://branches.spline.de/${BRANCH}/" - fi - - - if [ "${new}" = "0000000000000000000000000000000000000000" ]; then - rm -rf "${TARGET_DIR}" - exit 0 + RELATIVE="${BRANCH}" + + if [ "${new}" = "0000000000000000000000000000000000000000" ]; then + rm -rf "${TARGET_DIR}/${BRANCH}/" + exit 0 + fi fi TMP_DIR=$(mktemp -d) + TARGET_TMP_DIR=$(mktemp -d) git archive "${BRANCH}" | tar -C "${TMP_DIR}" -xf - >/dev/null 2>&1 # customize url in settings.cfg @@ -27,10 +29,15 @@ while read old new ref ; do # build website . /home/wartung/cyrax_env/bin/activate - mkdir -p "${TARGET_DIR}" - cyrax -q -d ${TARGET_DIR} ${TMP_DIR} - - rm -rf ${TMP_DIR} + mkdir -p "${TARGET_TMP_DIR}" + cyrax -q -d ${TARGET_TMP_DIR} ${TMP_DIR} + + mkdir -p "${TARGET_DIR}/${RELATIVE}/" + rm -rf "${TARGET_DIR}/${RELATIVE}/" + mv "${TARGET_TMP_DIR}/${RELATIVE}/" "${TARGET_DIR}/${RELATIVE}/" + + rm -rf "${TMP_DIR}" + rm -rf "${TARGET_TMP_DIR}" echo echo "Seite befindet sich nun auf:" |