From 77539319f8ac512b208281796be56e2b7bebb90e Mon Sep 17 00:00:00 2001 From: Mathias Klette Date: Tue, 31 Jul 2012 12:35:38 +0200 Subject: [PATCH] make it work as expected --- live_build.sh | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/live_build.sh b/live_build.sh index 0cf7790..0c2c873 100755 --- a/live_build.sh +++ b/live_build.sh @@ -14,40 +14,40 @@ fi # if [ "$1" == "" ] then - LIVE_TYPE="staging" + LIVE_TYPE="staging" else - LIVE_TYPE=$1 + LIVE_TYPE=$1 fi # # Define default settings # RSYNC_BASE=/srv/mirror/live-build -BUILD_DATE=$(date +%Y%m%d%H%M) -BUILD_ID="${LIVE_TYPE}-${BUILD_DATE}-${BUILD_NUMBER}" # BUILD_ID is used without lb_build.sh... +BUILD_DATE=${BUILD_DATE:=$(date +%Y%m%d%H%M)} +BUILD_ID="${LIVE_TYPE}-${BUILD_DATE}-${BUILD_NUMBER}" # BUILD_ID is used without lb_build.sh... BUILD_TARGET=$RSYNC_BASE/$BUILD_ID # # Overwrite settings depending on profile used # - i.e. not enough space in PBB to contain all images -# -case $LIVE_TYPE in +# +case $LIVE_TYPE in default|staging) RSYNC_SRC="$RSYNC_BASE/" RSYNC_DST="livebuild@10.1.1.1/livebuild/" - RSYNC_FILTER="--filter=\"+ default-*\" --filter=\"+ staging-*\" --filter=\"- *\"" + RSYNC_FILTER='--include=default-** --include=staging-** --exclude=*' ;; pbb|pre-staging) RSYNC_SRC="$BUILD_TARGET/" RSYNC_DST="livebuild@10.254.1.1/livebuild/" - RSYNC_FILTER="--filter=\"+ pbb-*\" --filter=\"+ pre-staging-*\" --filter=\"- *\"" + RSYNC_FILTER='' ;; esac # # Export variables for upcoming sudo-calls # -export LIVE_TYPE TARGET_RSYNC BUILD_DATE BUILD_ID BUILD_TARGET TARGET_BASE +export LIVE_TYPE BUILD_DATE BUILD_ID BUILD_TARGET RSYNC_BASE RSYNC_SRC RSYNC_DST RSYNC_FILTER # # Build @@ -63,7 +63,7 @@ ls -larth binary/live/ figlet "build OK" -# +# # Deploy # mkdir -p $BUILD_TARGET @@ -91,17 +91,17 @@ figlet "mirror OK" # # cleanup /srv/mirror, keep MAX number of images -# +# MAX=15 -cd $TARGET_BASE +cd $RSYNC_BASE COUNT=0 -for i in $(ls -artd1 ./${LIVE_TYPE}-*) ; do - let COUNT=COUNT+1 - if [ $COUNT -gt $MAX ] ; then - rm -rfv $i - else - echo "keeping $i" - fi +for i in $(ls -atd1 ./${LIVE_TYPE}-*) ; do + let COUNT=COUNT+1 + if [ $COUNT -gt $MAX ] ; then + rm -rfv $i + else + echo "keeping $i" + fi done figlet "cleanup OK" -- 2.39.5