User Virtual script to build debian packages for Xen 4.0.1-rc3

#!/bin/bash
# Written by User Virtual
# RELEASE-4.0.0
# 4.0.1-rc1

sudo apt-get install libcurl4-openssl-dev xserver-xorg-dev mercurial gitk build-essential libncurses5-dev uuid-dev gawk gettext texinfo bcc libncurses5-dev dpkg-dev debhelper iasl texinfo catdvi fakeroot bison flex
sudo apt-get build-dep xen-3.3

REPOS=xen-4.0-testing.hg
REPURL=http://xenbits.xensource.com/$REPOS

WRKD=/usr/src/build/400
IMGD=/usr/src/build/wget
STARTDIR=$(pwd)
export CONCURRENCY_LEVEL=$(grep processor /proc/cpuinfo | sed -n ‘$=’)
[ -d $WRKD ] || mkdir -p $WRKD
cd $WRKD
[ -d $REPOS ] || hg clone $REPURL #http://xenbits.xensource.com/$REPOS
cd $WRKD/$REPOS
if [ -n “$1” ]; then
LREL=$1
else
LREL=$(hg tags | sed ‘/^tip\b /d’ | sed -n ‘1 s/ *.*//p’) # RELEASE-4.0.0
fi
RELTAG=$(echo $LREL | sed ‘s/^RELEASE-//;s/-\([^-]*\)$/\1/’) # 4.0.0

[ -d $IMGD ] || mkdir -p $IMGD
#! hg pull | grep ‘^no changes found$’; CHANGED=$?; test -z $CHANGED && hg update
hg pull; hg update
echo hg archive –rev=$LREL –type=tgz –prefix=xen-$RELTAG $IMGD/xen-$RELTAG.tar.gz
[ -r $IMGD/xen-$RELTAG.tar.gz ] || \
hg archive –rev=$LREL –type=tgz –prefix=xen-$RELTAG $IMGD/xen-$RELTAG.tar.gz || \
exit $?
cd $WRKD
ORIGZ=xen-$(echo $RELTAG | sed ‘s/\.[^.]*$//’)_$RELTAG.orig.tar.gz
[ -r $ORIGZ ] || \
ln -sv $IMGD/xen-$RELTAG.tar.gz $ORIGZ

rm -rf xen-$RELTAG; tar xzf $ORIGZ

cd $WRKD/xen-$RELTAG
DIFNAME=xen-$(echo $RELTAG | sed ‘s/\.[^.]*$//’)_$RELTAG-0ubuntu1.diff.gz
cp -va $STARTDIR/$DIFNAME $WRKD/
zcat $WRKD/$DIFNAME | patch -p1

dpkg-buildpackage -rfakeroot && \
echo BUILT OK.
exit $?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: