9 echo "We need 3 arguments"
13 DATE=`date +"%Y%m%d%H"`
14 DIR="/home/autobuild/packages/staging/freeside$FS_VERSION/$DISTRO/$FS_REPO"
15 TARGET="/home/autobuild/public_html/freeside$FS_VERSION-$DISTRO-$FS_REPO"
17 if [ ! -d "$DIR" -a -d $TARGET ]; then
19 echo "Staging or Target directories do not exist"
23 GIT_VERSION=`grep '^$VERSION' $DIR/freeside/FS/FS.pm | cut -d\' -f2`
27 git checkout -- debian/changelog
29 LOCAL=`git rev-parse FREESIDE_${FS_VERSION}_BRANCH`
30 REMOTE=`git ls-remote origin -h refs/heads/FREESIDE_${FS_VERSION}_BRANCH | cut -f1`
32 if [ $LOCAL = $REMOTE ]; then
33 echo "No new changes in git; aborting build."
34 exit #there's no new changes
36 echo "New changes in git since last build; building new packages."
41 # Add the build information to changelog
42 if [ $FS_REPO != "stable" ]; then
43 dch -b --newversion $GIT_VERSION-$DATE "Auto-Build"
46 # Using pbuilder and pdebuild in chroot instead of building directly : dpkg-buildpackage -b -rfakeroot -uc -us
48 pdebuild --pbuilderroot sudo --debbuildopts "-b -rfakeroot -uc -us" --buildresult $TARGET --architecture all -- --distribution $DISTRO --basetgz /var/cache/pbuilder/$DISTRO.tgz
50 #--buildresult gets the file where it needs to be, may need to clean up DIR
52 cd $DIR && rm -f freeside_*
53 cd $TARGET && rm -f *.gz
55 apt-ftparchive -qq packages ./ >Packages
56 gzip -c Packages >Packages.gz
57 #bzip2 -c Packages >Packagez.bz2
58 apt-ftparchive -qq sources ./ >Sources
59 gzip -c Sources >Sources.gz
60 #bzip2 -c Sources >Sources.bz2
62 apt-ftparchive -qq release ./ >Release