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-04-07 00:27:24 +08:00
ln -sf distros/ubuntu1204 debian
2015-08-21 08:35:01 +08:00
else
2016-05-01 13:06:45 +08:00
ln -sf distros/ubuntu1604 debian
2015-08-21 08:35:01 +08:00
fi ;
2016-02-22 23:18:46 +08:00
# Auto-install all ZoneMinder's depedencies using the Debian control file
sudo apt-get install devscripts equivs
sudo mk-build-deps -ir ./debian/control
2016-01-20 00:13:36 +08:00
if [ -z ` hostname -d` ] ; then
2016-01-20 00:22:51 +08:00
AUTHOR = " `getent passwd $USER | cut -d ':' -f 5 | cut -d ',' -f 1` <`whoami`@`hostname`.local> "
2016-01-19 22:05:40 +08:00
else
2016-01-20 00:22:51 +08:00
AUTHOR = " `getent passwd $USER | cut -d ':' -f 5 | cut -d ',' -f 1` <`whoami`@`hostname`> "
2016-01-19 22:05:40 +08:00
fi
2015-08-21 08:35:01 +08:00
cat <<EOF > debian/changelog
zoneminder ( $VERSION -$DISTRO -$SNAPSHOT ) $DISTRO ; urgency = medium
*
2016-01-19 22:05:40 +08:00
-- $AUTHOR $DATE
2015-08-21 08:35:01 +08:00
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