blob: 6a48dea34862cf233818918f2b298f819d4c2173 [file] [log] [blame]
#!/bin/bash
# Set PROGram name
PROG=$(basename $0)
########################################################################
#+
#+ NAME
#+ $PROG - ChromeOS image pusher (.zip and .bin)
#+
#+ SYNOPSIS
#+ $PROG [--nolatest] [--beta] [--branch=<branch>]
#+ --board=<board> <image directory>
#+ $PROG [--help | -man]
#+ $PROG [--usage | -?]
#+
#+ DESCRIPTION
#+ Push images up to archive server, chromeos-images and chrome-master.mtv.
#+ Always pushes up to -rc (release candidate) namespace.
#+
#+ OPTIONS
#+ [--beta] - Beta Channel
#+ [--nolatest] - Do not set LATEST file
#+ [--branch] - branch value determines if support
#+ scripts also get updated
#+ [--help | -man] - display man page for this script
#+ [--usage | -?] - display usage information
#+
#+ EXAMPLES
#+
#+ FILES
#+
#+ SEE ALSO
#+ stdlib.sh - function definitions for TimeStamp, etc.
#+
#+ BUGS/TODO
#+
#- AUTHOR & DT : djmm Wed Jul 21 15:02:45 PDT 2010
#-
########################################################################
# If NO ARGUMENTS should return *usage*, uncomment the following line:
usage=${1-yes}
# This construct allows $PROG to be a symlink or simply PATH'd to
symlink=$(readlink $0)
# Set up basic env and standard functions
. $(dirname ${symlink:-$0})/stdlib.sh
# Set some default options
VERBOSE=false
CHANNEL=dev-channel
NOLATEST=false
RC=-rc
for arg in $LOOSEARGS
do
case "$arg" in
--beta) CHANNEL=beta-channel ;;
--nolatest) NOLATEST=true ;;
-v) VERBOSE=true ;;
*) looseargs="$looseargs $arg" ;;
esac
done
# strip leading spaces from final looseargs to pass to program
basedir=$(echo $looseargs)
basedir=$(cd $basedir && pwd)
if [ -z "$board" ]
then
$PROG -?
exit
fi
BOARD=$board
###############################################################################
# MAIN
###############################################################################
TOOLDIR=$(CanonicalizePath $(dirname $0))
cversion=$(basename $basedir)
cversion2=${cversion%%-*}
binfile=/tmp/ChromeOS-$cversion-$BOARD.bin.gz
image_host='chromeos-images.corp.google.com'
# This should change based on architecture/board and dev/beta channel
imagetarget_base=/var/www/chromeos-official
imagetarget=$imagetarget_base/$CHANNEL/$BOARD$RC
usbtarget=/usr/local/google/cltbld/chromeos/$CHANNEL
baseimagename=chromiumos_base_image.bin
baseimage=$(dirname $basedir)/src/build/images/$BOARD/$cversion2-a1/$baseimagename
# BEGIN script
TimeStamp begin
ReleaseNotify() {
local lmailto=${1:-"$USER"}
local lmailfile=/tmp/$PROG-mail.$$
logecho -r
logecho "Notifying $lmailto of release push..."
cat <<+_MailFile > $lmailfile
$cversion2 $BOARD is ready for testing at http://go/chromeos-images.
<P>
The ChromeOS-RE Team
+_MailFile
mail -s "ChromeOS $cversion2 $BOARD ready for testing" \
-a "From: ChromeOS Releng<chromeos-re@google.com>" \
-a "Content-type: text/html" $lmailto < $lmailfile
# cleanup
rm -f $lmailfile
}
# SEND TO MAIN IMAGE TARGET
if ssh $image_host test -d $imagetarget/$cversion2
then
logecho "$imagetarget/$cversion2 already exists. Skipping..."
else
logecho "Sending images up to $imagetarget/$cversion2..."
ssh $image_host mkdir -p $imagetarget/$cversion2
scp $basedir/image.zip $image_host:$imagetarget/$cversion2/ChromeOS-$cversion-$BOARD.zip
scp $basedir/factory_image.zip $image_host:$imagetarget/$cversion2/ChromeOS-factory-$cversion-$BOARD.zip
scp $basedir/*.tar.bz2 $image_host:$imagetarget/$cversion2
if [ -f $basedir/au-generator.zip ]; then
scp $basedir/au-generator.zip $image_host:$imagetarget/$cversion2/
fi
scp $basedir/debug.tgz $image_host:$imagetarget/$cversion2/debug-$BOARD.tgz
# Copy the build log, ChangeLog and manifest.xml files
scp $basedir/*.log $basedir/*.*ml $image_host:$imagetarget/$cversion2
# Put up a temp copy of the script to use
remote_tooldir=/tmp/pushimage.$$
ssh $image_host "rm -rf $remote_tooldir && mkdir -p $remote_tooldir"
scp $TOOLDIR/contrib/channelsign $TOOLDIR/contrib/gsrestore \
$image_host:$remote_tooldir
instructionsfile=$TOOLDIR/signer_instructions/$BOARD.instructions
if [ -f $instructionsfile ]
then
# Copy over the new format signing instructions.
scp $instructionsfile \
$image_host:$imagetarget/$cversion2/ChromeOS-$cversion-$BOARD.instructions
# Check signing instructions for final destination
signingchannels=$(awk '/^channel/ {print $3}' $instructionsfile |sort -u)
for sc in $signingchannels
do
if [ "$sc" = dev ]
then
# Set signing for dev
logecho "Touching .tobesigned file..."
ssh $image_host touch $imagetarget/$cversion2/.tobesigned
else
# Or move channels
ssh $image_host "cd $imagetarget_base && \
$remote_tooldir/channelsign $cversion2 $sc $BOARD && \
rm -rf $remote_tooldir"
fi
done
fi
$NOLATEST || ssh $image_host "cd $imagetarget && echo $cversion > LATEST"
ReleaseNotify chromeos-releases@google.com
fi
# Cleanup
ssh $image_host rm -rf $remote_tooldir
# END script
TimeStamp end