Skip to content

Instantly share code, notes, and snippets.

@reactorcoremeltdown
Created February 12, 2015 21:55
Show Gist options
  • Save reactorcoremeltdown/b60e97c6098d8f8851bf to your computer and use it in GitHub Desktop.
Save reactorcoremeltdown/b60e97c6098d8f8851bf to your computer and use it in GitHub Desktop.
powerful hooks
#!/usr/bin/env bash
#set -x
source /etc/chrootci.sh
repo=`basename $PWD | cut -f 1 -d '.'`
commitmessage=`git log -1 HEAD --pretty=format:%s`
echo $repo > /tmp/buildinfo
if [ -d /tmp/packages ]; then
rm -f /tmp/packages/*
else
mkdir /tmp/packages
fi
for i in $distributions; do
for j in $architectures; do
chroot $rootdir/$i/$j bash -c "
echo -e '\e[0;32m'$i'/'$j'\e[0m'
cd /root/dev
if [ -d $repo ]; then
cd $repo
unset GIT_DIR
git pull
else
git clone `whoami`@`hostname -f`:$PWD && cd $repo
fi
source ./package.sh
echo \"suffix: \"\$SUFFIX
rm /root/dev/$repo*.orig.tar.?z
if [ -f ./autogen.sh ];then
./autogen.sh
fi
dh_make --createorig -p \$NAME\"_\"\$VERSION\"+\"\$(lsb_release -cs) --yes --single
dch --force-distribution -D \$(lsb_release -cs) -v \$VERSION\"+\"\$(lsb_release -cs)\"-\"\$SUFFIX $commitmessage
if debuild > /tmp/debuild.log 2>&1; then
echo -e '\e[0;34mbuild succeed\e[0m'
ssh `whoami`@`hostname -f` buildinfo $i $j succeed
else
echo -e '\e[0;31mbuild failed\e[0m'
ssh `whoami`@`hostname -f` buildinfo $i $j failed
fi
debclean > /dev/null
dupload --to wasteland /root/dev/\$NAME\"_\"\$VERSION\"+\"\$(lsb_release -cs)\"-\"\$SUFFIX\"_\"$j\".changes\"
" &
done
done
wait
cat /tmp/buildinfo
echo -e "\a"
rootdir="/opt/chroot"
distributions="wheezy
jessie
precise
trusty"
architectures="i386
amd64"
DEBFULLNAME='Azer Abdullaev (Like All)'
DEBEMAIL='[email protected]'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment