summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Sulfrian <alex@spline.inf.fu-berlin.de>2012-08-20 21:41:31 +0200
committerwartung <wartung@vm-staticweb.spline.inf.fu-berlin.de>2012-08-20 21:53:16 +0200
commit951dc1fa9e6d519fc9e8a45f1d1126490ad37875 (patch)
tree408ac108a148d9faeb53ee32c4d3a103989146d3
parent5e0d3562ae6762925ab05eb6881a4780d3243db0 (diff)
downloadhooks-951dc1fa9e6d519fc9e8a45f1d1126490ad37875.tar.gz
hooks-951dc1fa9e6d519fc9e8a45f1d1126490ad37875.tar.bz2
hooks-951dc1fa9e6d519fc9e8a45f1d1126490ad37875.zip
cyrax-build: do not delete other branches on update
-rwxr-xr-xpost-receive.cyrax-build27
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:"