| | |
| | | CONF_FILE=$TOP_PATH/config.json |
| | | |
| | | # Download path |
| | | DL_PATH="/srv/yocto_packets/" |
| | | #DL_PATH="/srv/yocto_packets/" |
| | | |
| | | # shell script will exit once get command error |
| | | set -e |
| | |
| | | export BOARD=`jq -r ".bsp.board" $CONF_FILE | tr 'A-Z' 'a-z'` |
| | | export BSP_VER=`jq -r ".bsp.version" $CONF_FILE | tr 'A-Z' 'a-z'` |
| | | export YCT_VER=`jq -r ".system.version" $CONF_FILE | tr 'A-Z' 'a-z'` |
| | | export BSP_URL=`jq -r ".bsp.giturl" $CONF_FILE` |
| | | |
| | | export YCT_BOARD=`echo $BOARD| cut -d- -f1` |
| | | export YCT_META=meta-$YCT_BOARD |
| | | export YCT_PATH=$PRJ_PATH/$YCT_VER-$BSP_VER |
| | | export YCT_SRC=$YCT_VER-$BSP_VER |
| | | export YCT_PATH=$PRJ_PATH/$YCT_SRC |
| | | export BUILD_DIR=${BOARD} |
| | | } |
| | | |
| | | function do_fetch() |
| | | { |
| | | cd $PRJ_PATH |
| | | |
| | | mkdir -p $YCT_PATH && cd $YCT_PATH |
| | | if [ ! -d $YCT_SRC/sources ] ; then |
| | | |
| | | if [ ! -d sources ] ; then |
| | | if [[ $BSP_URL =~ github.com ]] ; then |
| | | |
| | | pr_info "start repo fetch Yocto $YCT_VER source code" |
| | | |
| | | mkdir -p $YCT_PATH && cd $YCT_PATH |
| | | |
| | | if ! command -v repo > /dev/null 2>&1 ; then |
| | | curl https://storage.googleapis.com/git-repo-downloads/repo > repo |
| | |
| | | repo sync && rm -f repo |
| | | |
| | | else |
| | | |
| | | pr_info "start download fetch Yocto $YCT_VER source code" |
| | | |
| | | mkdir -p $TARBALL_PATH |
| | | |
| | | # Download source code packet |
| | | if [ ! -s $TARBALL_PATH/$YCT_SRC.tar.xz ] ; then |
| | | wget $BSP_URL/bsp/$BSP_VER/$YCT_SRC.tar.xz -P $TARBALL_PATH |
| | | fi |
| | | |
| | | # decompress source code packet |
| | | do_unpack $TARBALL_PATH/$YCT_SRC.tar.xz |
| | | |
| | | fi |
| | | |
| | | else |
| | | pr_warn "Yocto $YCT_VER source code fetched already" |
| | | fi |
| | | |