Shell Script Execution Dailybuild

Source: Internet
Author: User
Tags mkdir git clone yocto
#!/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 "has 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. ---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
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.