#!/bin/bash SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" source ${SCRIPT_DIR}/platforms-common.sh WORKSPACE=$PWD YYMM=${1:-`date +%y`.`date +%m`} REV=${2:-1} function check_params { if [[ $YYMM == [0-9][0-9].[0-9][0-9] ]]; then if [[ $REV != [0-9] ]]; then echo "ERROR: you need to specify a number as the second arg, but you did \"$REV\"" exit 1 fi else echo "ERROR: you need to specify YY.MM as the first arg, but you did \"$YYMM\"" exit 1 fi } function update_tarball { pushd recovery # there should be a marker file named juno-${YY}.${MM}-linaro${REL} # if not we should create it local pattern="juno-[0-9][0-9].[0-9][0-9]-linaro[0-9]" local count=0 local markerfile=juno-${YYMM}-linaro${REV} if [ -e ${pattern} ]; then # if a marker file exists, but it has the wrong version, abort if [ ${pattern} != ${markerfile} ]; then echo "ERROR: a marker file exists, but has the wrong version" echo "ERROR: I expected: ${markerfile}" echo "ERROR: but found: `ls $pattern`" exit 1 fi count=`ls ${pattern} | wc -l` fi if [[ "$count" == "0" ]]; then # the marker file doesn't exist, so create it echo "Creating marker file ${markerfile}" find . -name "*" -type f | \ grep -v -e .git -e ${markerfile} | \ sort | \ xargs md5sum > ${markerfile} # check the marker file in git add ${markerfile} git commit -s -a -m "${markerfile}" # tag it git tag ${markerfile} git push working ${markerfile} # update the juno, junor1 and junor2 branches git branch -f juno git branch -f junor1 git branch -f junor2 git push working git push working juno git push working junor1 git push working junor2 count=1 fi if [[ "$count" != "1" ]]; then echo "ERROR: There should only be one marker file, but I see ${count}" exit 1 fi local ver=${YYMM}-linaro${REV} echo "Tarball version: $ver" # generate the recovery tarball tar jcvf ${WORKSPACE}/board_recovery_image.tar.bz2 * # save current branch local initial_branch=`echo $(git branch | grep "*" | sed "s/* //")` # swap to recovery branch git checkout juno-recovery-tarball # copy in the recovery tarball cp ${WORKSPACE}/board_recovery_image.tar.bz2 . git commit -s -a -m "board_recovery_image (version ${ver})" local tag=tarball-${ver} git tag $tag git push working $tag git push working juno-recovery-tarball # now we're finished, checkout the branch where we started git checkout $initial_branch popd } check_params check_workspace update_tarball