shell 指令碼執行dailybuild

來源:互聯網
上載者:User
#!/bin/bash

DestMailsList=("xxx@xxx.com");
BUILD_DIR=g3_asic_yocto
LOG_FILE="g3_asic_dailybuild.txt"
TAIL_FILE="./tail.txt"
#CurTime=$(date "+%Y%m%d")
DayTimeTag=$(date "+%Y%m%d")
MonTimeTag=$(date "+%Y%m")
YestTag=$(date -d '3 days ago' +%Y%m%d)
WORK_DIR=/space/pchen/g3_yocto_build/

cd $WORK_DIR
CurDIR=$(pwd)

if [ -d $MonTimeTag ]; then
    echo "Have created dir $MonTimeTag"
else
    mkdir $MonTimeTag
fi
mkdir $MonTimeTag/$DayTimeTag

#Gitclone Source Codes of Titan.
if [ -d $BUILD_DIR-$YestTag ]; then
    echo "The Source Codes had git cloned before should be removed first."
    rm $BUILD_DIR-$YestTag -rf
else
    echo "The First time to Git clone the Source Code and build. "
fi

git clone -b g3-krogoth-master gitolite@cs-local-gitmirror:sw/platforms/cs-unified/distro/yocto $BUILD_DIR-$DayTimeTag
cd $BUILD_DIR-$DayTimeTag

git clone -b g3-krogoth-master gitolite@cs-local-gitmirror:sw/platforms/cs-unified/distro/openembedded/meta-openembedded
git clone -b g3-krogoth-master gitolite@cs-local-gitmirror:sw/platforms/cs-unified/distro/meta-oe-yocto-cortina
git clone -b g3-krogoth-master gitolite@cs-local-gitmirror:sw/platforms/cs-unified/distro/meta-ca-bsp
export TEMPLATECONF=meta-ca-bsp/conf/g3-eng/
#pwd
#ls
source ./oe-init-build-env

#Make build
bitbake basic-image > $CurDIR/$LOG_FILE

#Copy the output image
cd $CurDIR
#echo $CurDIR
#echo $CurTime
#if [ -d $CurTime ]; then
#    echo "remove the first."
#    rm $CurTime -rf
#    mkdir $CurTime
#else
#    echo "12233"
#    mkdir $CurTime
#fi

cp $BUILD_DIR-$DayTimeTag/build/tmp/deploy/images/g3-eng/Image $MonTimeTag/$DayTimeTag
cp $BUILD_DIR-$DayTimeTag/build/tmp/deploy/images/g3-eng/Image-ca7774-engboard.dtb $MonTimeTag/$DayTimeTag
cp $BUILD_DIR-$DayTimeTag/build/tmp/deploy/images/g3-eng/basic-image-g3-eng.cpio.xz  $MonTimeTag/$DayTimeTag
cp $BUILD_DIR-$DayTimeTag/build/tmp/deploy/images/g3-eng/u-boot.bin $MonTimeTag/$DayTimeTag
cp $LOG_FILE $MonTimeTag/$DayTimeTag/$DayTimeTag-$LOG_FILE

tail -10 $LOG_FILE > $TAIL_FILE
grep -I "Error" $TAIL_FILE
if [ $? -eq 0 ]; then
    echo "The daily compile building had failed. --- Please refer the attchment log file!" > $TAIL_FILE
else
    echo "The daily compile building had PASSED successful. --- OK!" > $TAIL_FILE
fi
echo "#######################################################" >> $TAIL_FILE
echo "" >> $TAIL_FILE
echo "... ... ..." >> $TAIL_FILE
echo "" >> $TAIL_FILE
tail -20 $LOG_FILE >> $TAIL_FILE

#Restart the Mail Services
#service postfix restart
#service sendmail restart

#Send Emails
for m in ${DestMailsList[@]}; do
   echo $m
   cat $TAIL_FILE | mutt -s "G3 ASIC YOCTO Daily Build - "$DayTimeTag $m -a $LOG_FILE
done
#End
相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.