#
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
figlet "build OK"
-#
+#
# Deploy
#
mkdir -p $BUILD_TARGET
#
# 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"