2015-08-21 08:35:01 +08:00
#!/bin/bash
2016-01-21 05:09:12 +08:00
if [ " $1 " = = "clean" ] ; then
read -p "Do you really want to delete existing packages? [y/N]"
[ [ $REPLY = = [ yY] ] ] && { rm -fr zoneminder*.build zoneminder*.changes zoneminder*.deb; echo "Existing package files deleted" ; } || { echo "Packages have NOT been deleted" ; }
exit;
fi
2015-08-21 08:35:01 +08:00
DATE = ` date -R`
DISTRO = $1
SNAPSHOT = $2
2016-01-05 22:04:04 +08:00
if [ " $SNAPSHOT " = = "stable" ] ; then
2016-01-21 05:11:35 +08:00
SNAPSHOT = "" ;
2016-01-05 22:04:04 +08:00
fi ;
2016-01-21 05:09:12 +08:00
2015-08-21 08:35:01 +08:00
TYPE = $3
if [ " $TYPE " = = "" ] ; then
TYPE = "source" ;
fi ;
2016-01-05 22:04:04 +08:00
BRANCH = $4
2015-08-21 08:35:01 +08:00
2016-01-21 05:09:12 +08:00
2015-08-21 08:35:01 +08:00
if [ ! -d 'zoneminder_release' ] ; then
2016-01-05 22:04:04 +08:00
git clone https://github.com/ZoneMinder/ZoneMinder.git zoneminder_release
fi ;
if [ " $BRANCH " != "" ] ; then
cd zoneminder_release
2016-01-21 05:09:12 +08:00
if [ " $BRANCH " = = "stable" ] ; then
BRANCH = $( git describe --tags $( git rev-list --tags --max-count= 1) ) ;
echo " Latest stable branch is $BRANCH " ;
fi
2016-01-05 22:04:04 +08:00
git checkout $BRANCH
cd ../
2015-08-21 08:35:01 +08:00
fi ;
VERSION = ` cat zoneminder_release/version`
if [ $VERSION = = "" ] ; then
2016-01-05 22:04:04 +08:00
exit 1;
2015-08-21 08:35:01 +08:00
fi ;
echo " Doing $TYPE release zoneminder_ $VERSION - $DISTRO - $SNAPSHOT " ;
mv zoneminder_release zoneminder_$VERSION -$DISTRO -$SNAPSHOT .orig
cd zoneminder_$VERSION -$DISTRO -$SNAPSHOT .orig
git submodule init
git submodule update --init --recursive
if [ $DISTRO = = "trusty" ] ; then
2016-01-05 22:04:04 +08:00
ln -sf distros/ubuntu1204_cmake debian
2015-08-21 08:35:01 +08:00
else
2016-01-05 22:04:04 +08:00
ln -sf distros/ubuntu1504_cmake debian
2015-08-21 08:35:01 +08:00
fi ;
cat <<EOF > debian/changelog
zoneminder ( $VERSION -$DISTRO -$SNAPSHOT ) $DISTRO ; urgency = medium
*
-- Isaac Connor <iconnor@connortechnology.com> $DATE
EOF
2016-01-05 22:04:04 +08:00
#rm -rf .git
#rm .gitignore
#cd ../
#tar zcf zoneminder_$VERSION-$DISTRO.orig.tar.gz zoneminder_$VERSION-$DISTRO-$SNAPSHOT.orig
#cd zoneminder_$VERSION-$DISTRO-$SNAPSHOT.orig
2015-08-21 08:35:01 +08:00
if [ $TYPE = = "binary" ] ; then
2016-01-05 22:04:04 +08:00
debuild
2015-08-21 08:35:01 +08:00
else
2016-01-19 10:39:33 +08:00
if [ $TYPE = = "local" ] ; then
debuild -i -us -uc -b
else
debuild -S -sa
fi ;
2015-08-21 08:35:01 +08:00
fi ;
2016-01-05 22:04:04 +08:00
2015-08-21 08:35:01 +08:00
cd ../
2016-01-21 05:09:12 +08:00
read -p "Do you want to keep the checked out version of Zoneminder (incase you want to modify it later) [y/N]"
[ [ $REPLY = = [ yY] ] ] && { mv zoneminder_$VERSION -$DISTRO -$SNAPSHOT .orig zoneminder_release; echo "The checked out copy is preserved in zoneminder_release" ; } || { rm -fr zoneminder_$VERSION -$DISTRO -$SNAPSHOT .orig; echo "The checked out copy has been deleted" ; }
echo "Done!"
2016-01-05 22:04:04 +08:00