OsmAnd/build-scripts/daily_build.sh

60 lines
1.3 KiB
Bash
Raw Normal View History

2011-01-23 12:45:18 +01:00
#!/bin/sh
DIRECTORY=$(cd `dirname $0` && pwd)
## VARIABLES ###
LOG_DIR="$DIRECTORY"/logs
DATE=$(date +%d-%m-%y)
2011-10-07 01:32:52 +02:00
CLOG_FILE="$LOG_DIR/${DATE}.log"
LOG_FILE="$LOG_DIR/tmp.log"
LOCK_FILE="$DIRECTORY"/build.lock
if [ -f $LOCK_FILE ]; then
exit
fi
touch $LOCK_FILE
2011-01-23 12:45:18 +01:00
2011-10-07 01:32:52 +02:00
mkdir -p $LOG_DIR
echo > $LOG_FILE
touch $CLOG_FILE
2011-01-23 12:45:18 +01:00
2011-10-11 22:14:55 +02:00
cd "${DIRECTORY}"
2011-10-11 23:03:56 +02:00
git pull --rebase >>$LOG_FILE 2>&1
2011-01-23 12:45:18 +01:00
# 1. Update git directory
2011-10-07 01:32:52 +02:00
"${DIRECTORY}/update_git.sh" >>$LOG_FILE 2>&1
2011-01-23 12:45:18 +01:00
# 2. Go through branches and generates builds
2011-10-07 01:32:52 +02:00
"${DIRECTORY}/build_branches.sh" >>$LOG_FILE 2>&1
2011-10-11 22:20:09 +02:00
2011-10-11 21:38:51 +02:00
# exit if nothing was changed
2011-10-11 23:03:56 +02:00
# if [ $? = 0 ]; then
# exit 0
# fi
2011-01-23 12:45:18 +01:00
2011-01-23 13:28:17 +01:00
# 3. upload to ftp server
#"${DIRECTORY}/upload_ftp.sh" 2>&1 >>$LOG_FILE
# 3. upload to ftp server
2011-10-07 01:32:52 +02:00
"${DIRECTORY}/copyto_dir.sh" >>$LOG_FILE 2>&1
2011-01-23 12:45:18 +01:00
# 4. Synchronize github with googlecode mercurial
2011-10-07 01:32:52 +02:00
"${DIRECTORY}/sync_git_google.sh" >>$LOG_FILE 2>&1
2011-01-23 12:45:18 +01:00
2011-08-29 03:13:59 +02:00
# 5. update site files
2011-10-07 01:32:52 +02:00
"${DIRECTORY}/update_site.sh" >>$LOG_FILE 2>&1
cat $LOG_FILE >> $CLOG_FILE
BUILD=`ls *.fixed *.failed 2> /dev/null | wc -l`
2011-10-07 01:32:52 +02:00
if [ ! $BUILD -eq 0 ]; then
# if some status change, print out complete log
echo "Builds status changed"
echo "-------------"
echo `ls *.fixed *.failed 2> /dev/null`
echo "-------------"
echo "Complete log file:"
2011-10-07 01:32:52 +02:00
echo "-------------"
cat $LOG_FILE
fi
rm -f $LOCK_FILE