Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 120 lines (109 sloc) 3.82 KB
#!/bin/bash
# Make sure to specify the build to grab. I know I could just grab current
# but honestly, do some work yourself!
release=$1
fragged=0
IMAGENAME=Angstrom-bug-image-production-glibc-ipk-2009.X-stable-bug20.rootfs.tar
INCRURL=http://dauber/buildbot/trunk/incremental/
FULLURL=http://dauber/buildbot/trunk/full/
REPOURL=http://dauber/buildbot/repo/full/
#ACCTURL=http://bugcommunity.com/downloads/accenture/
ACCTURL=http://dauber/buildbot/accenture/full/
EXT_URL=http://repo.buglabs.net/buildbot-images/2.0/
if [ "$1" == "--help" ]; then
echo "$0 [Build Number] [full|incr|acct]"
echo "$0 with no arguments will tell you the latest build number for each tree"
echo -e "\trc will pull from the repo/full/RC builds"
echo -e "\tfull will pull from the full builds"
echo -e "\tincr will pull from the incremental builds"
echo -e "\tacct will pull from the Accenture specific builds"
echo
echo "I must be getting soft, there is a special mode for external pulls --bbot no other args"
echo "You need superuser privs to run this, sudo please"
fi
if [[ $EUID -ne 0 ]] && [[ $# -ne 0 ]]; then
echo "You need superuser privs to do anything constructive, sudo please"
exit 1
fi
if [ "$1" == "--bbot" ]; then
BASEURL=$EXT_URL
release=$(wget -q -O - $EXT_URL/svninfo | grep Revision | sed 's/Revision: //')
elif [ "$2" == "rc" ]; then
BASEURL=$REPOURL
elif [ "$2" == "full" ]; then
BASEURL=$FULLURL
elif [ "$2" == "acct" ]; then
BASEURL=$ACCTURL
elif [ "$2" == "incr" ]; then
BASEURL=$INCRURL
else
BASEURL=$FULLURL
fi
if [ -z $release ]; then
echo please specify the svn build \# of the rc ya want
echo the current releases are:
echo $EXT_URL
wget -q -O - $EXT_URL/svninfo | grep Revision
for URL in $REPOURL $FULLURL $ACCTURL $INCRURL ; do
echo $URL :
wget -q -O - $URL/current/svninfo | grep Revision
done
exit
fi
if [ "$1" == "--bbot" ]; then
# grab the tarball
wget -r -nd -np ${BASEURL}${IMAGENAME}.gz
# quick and dirty way to see if we got a good pull
if [ ! -f ${IMAGENAME}.gz ]; then
echo "You took the easy way and it didn't work. Nice"
echo "There is no hope for this option, the build is broke, the network is broke, something broke"
echo Try later, tomorrow, cry on IRC, I dunno. kthxbai
exit
fi
# and the md5 file
wget -r -nd -np ${BASEURL}${IMAGENAME}.gz.md5
if [ $? -ne 0 ]; then
echo Seriously, nothing ever goes right, eh?
echo Go plug in your network cable and see if $release actually built
exit
fi
else
# grab the tarball
wget -r -nd -np $BASEURL${release}/${IMAGENAME}.gz
# quick and dirty way to see if we got a good pull
if [ ! -f ${IMAGENAME}.gz ]; then
echo You are pissing me off. Did you even give me a valid release number?
echo Current is $(wget -q -O - ${BASEURL}current/svninfo | grep Revision)
echo kthxbai
exit
fi
# and the md5 file
wget -r -nd -np $BASEURL${release}/${IMAGENAME}.gz.md5
if [ $? -ne 0 ]; then
echo Seriously, do you hate me that much? I can not get there from here.
echo Go plug in your network cable and see if $release actually built
exit
fi
fi
#clean up paths in md5 files
sed -i 's/ [\.|\/].*\/\(.*\)/ \1/' ${IMAGENAME}.gz.md5
md5sum -c ${IMAGENAME}.gz.md5
if [ $? -ne 0 ]; then
echo '******************************************************** '
echo MD5 sum of file ${IMAGENAME}.gz did not match
echo I echo didn\'t get the rootfs down clean, check your net
echo check your teeth, maybe your shoe is untied, TRY AGAIN
echo '******************************************************** '
exit 1
fi
# In the future, error checking is whay you want to put in here
gunzip ${IMAGENAME}.gz
mv ${IMAGENAME} $release.rootfs.tar
TMPDIR=$(mktemp -d)
cd $TMPDIR
tar xf ${OLDPWD}/$release.rootfs.tar
find -type f -exec md5sum {} \; > ${OLDPWD}/$release.rootfs.tar.list.md5
cd ${OLDPWD}
rm -rf $TMPDIR
rm -f ${IMAGENAME}.gz.md5
md5sum $release.rootfs.tar > $release.rootfs.tar.md5