This commit is contained in:
Andy Bauer 2017-04-15 09:24:45 -05:00
commit 3b1ef579d5
13 changed files with 534 additions and 153 deletions

View File

@ -2,50 +2,53 @@ language: cpp
sudo: required
dist: trusty
notifications:
irc: "chat.freenode.net#zoneminder-dev"
irc: chat.freenode.net#zoneminder-dev
branches:
except:
- modern
- modern
cache: ccache
addons:
sauce_connect:
username: "zoneminder"
access_key: "046ec7c1-c598-4e7e-949a-f86e725d1722"
ssh_known_hosts: zmrepo.zoneminder.com
apt:
sources:
- sourceline: ppa:iconnor/zoneminder
- key_url: http://keyserver.ubuntu.com:11371/pks/lookup?op=get&search=0x4D0BF748776FFB04
packages:
- gdebi
- yum-utils
- patch
- git
- curl
- sshfs
env:
global:
- LD_LIBRARY_PATH="/usr/local/lib:/opt/libjpeg-turbo/lib:$LD_LIBRARY_PATH"
- DEB_HOST_GNU_TYPE=$(dpkg-architecture -qDEB_HOST_GNU_TYPE)
- DEB_BUILD_GNU_TYPE=$(dpkg-architecture -qDEB_BUILD_GNU_TYPE)
- CFLAGS="-DZM_FFMPEG_CVS -DHAVE_LIBCRYPTO -I/usr/local/include"
- CXXFLAGS="$CFLAGS"
matrix:
- ZM_BUILDMETHOD=cmake
- OS=el DIST=6
- OS=el DIST=7
- OS=fedora DIST=24
- OS=fedora DIST=25
- OS=ubuntu DIST=trusty
- OS=ubuntu DIST=xenial
- OS=ubuntu DIST=trusty ARCH=i386
- OS=ubuntu DIST=xenial ARCH=i386
compiler:
- gcc
- clang
- gcc
services:
- mysql
before_install:
- sudo apt-get update -qq
- sudo apt-get install -y libpolkit-gobject-1-dev zlib1g-dev apache2 php5 php5-mysql build-essential libmysqlclient-dev libssl-dev libbz2-dev libpcre3-dev libdbi-perl libarchive-zip-perl libdate-manip-perl libdevice-serialport-perl libmime-perl libwww-perl libdbd-mysql-perl libsys-mmap-perl yasm automake autoconf cmake libjpeg-turbo8-dev apache2-mpm-prefork libapache2-mod-php5 php5-cli libtheora-dev libvorbis-dev libvpx-dev libx264-dev libvlccore-dev libvlc-dev
install:
- git clone -b n3.0 --depth=1 git://source.ffmpeg.org/ffmpeg.git
- cd ffmpeg
- ./configure --enable-shared --enable-swscale --enable-gpl --enable-libx264 --enable-libvpx --enable-libvorbis --enable-libtheora
- make -j `grep processor /proc/cpuinfo|wc -l`
- sudo make install
- sudo make install-libs
before_script:
- cd $TRAVIS_BUILD_DIR
- mysql -uroot -e "CREATE DATABASE IF NOT EXISTS zm"
- mysql -uroot -e "GRANT ALL ON zm.* TO 'zmuser'@'localhost' IDENTIFIED BY 'zmpass'";
- mysql -uroot -e "FLUSH PRIVILEGES"
- mysql
- docker
script:
- if [ "$ZM_BUILDMETHOD" = "cmake" ]; then cmake -DZM_ONVIF=OFF -DCMAKE_INSTALL_PREFIX="/usr"; fi
- make
- sudo make install
- if [ "$ZM_BUILDMETHOD" = "cmake" ]; then sudo ./zmlinkcontent.sh; fi
- mysql -uzmuser -pzmpass < db/zm_create.sql
- mysql -uzmuser -pzmpass zm < db/test.monitor.sql
- sudo zmpkg.pl start
- sudo zmfilter.pl -f purgewhenfull
- utils/packpack/startpackpack.sh
before_deploy:
- openssl aes-256-cbc -K $encrypted_92a2ad18ba0b_key -iv $encrypted_92a2ad18ba0b_iv
-in deploy_rsa.enc -out /tmp/deploy_rsa -d
- eval "$(ssh-agent -s)"
- chmod 600 /tmp/deploy_rsa
- ssh-add /tmp/deploy_rsa
deploy:
provider: script
skip_cleanup: true
script: utils/packpack/rsync_xfer.sh
on:
branch: master

89
distros/ubuntu1204/rules.orig Executable file
View File

@ -0,0 +1,89 @@
#!/usr/bin/make -f
# -*- makefile -*-
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_LDFLAGS_MAINT_APPEND += -Wl,--as-needed
ifeq ($(DEB_BUILD_ARCH_OS),hurd)
ARGS:= -DZM_NO_MMAP=ON
endif
%:
dh $@ --parallel --buildsystem=cmake --builddirectory=dbuild \
--with sphinxdoc,apache2,linktree
override_dh_auto_configure:
dh_auto_configure -- $(ARGS) \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DCMAKE_BUILD_TYPE=Release \
-DZM_CONFIG_DIR="/etc/zm" \
-DZM_RUNDIR="/var/run/zm" \
-DZM_SOCKDIR="/var/run/zm" \
-DZM_TMPDIR="/tmp/zm" \
-DZM_CGIDIR="/usr/lib/zoneminder/cgi-bin" \
-DZM_CONTENTDIR="/var/cache/zoneminder"
override_dh_clean:
dh_clean $(MANPAGES1)
$(RM) -r docs/_build docs/installationguide
build-indep:
#$(MAKE) -C docs text
$(MAKE) -C docs html
MANPAGES1 = dbuild/scripts/zmupdate.pl.1
$(MANPAGES1):
# generate man page(s):
pod2man -s1 --stderr --utf8 $(patsubst %.1, %, $@) $@
## reproducible build:
LAST_CHANGE=$(shell dpkg-parsechangelog -S Date)
BUILD_DATE=$(shell LC_ALL=C date -u "+%B %d, %Y" -d "$(LAST_CHANGE)")
override_dh_installman: $(MANPAGES1)
$(MAKE) -C docs man SPHINXOPTS="-D today=\"$(BUILD_DATE)\""
dh_installman --language=C $(MANPAGES1)
override_dh_auto_install:
dh_auto_install --destdir=$(CURDIR)/debian/tmp
# remove worthless files:
$(RM) -v $(CURDIR)/debian/tmp/usr/share/perl5/*/*/*/.packlist
$(RM) -v $(CURDIR)/debian/tmp/usr/share/perl5/*/*.in
# remove empty directories:
find $(CURDIR)/debian/tmp/usr -type d -empty -delete -printf 'removed %p\n'
# remove extra-license-file:
$(RM) -v $(CURDIR)/debian/tmp/usr/share/zoneminder/www/api/lib/Cake/LICENSE.txt
override_dh_fixperms:
dh_fixperms
#
# As requested by the Debian Webapps Policy Manual §3.2.1
chown root:www-data $(CURDIR)/debian/zoneminder/etc/zm/zm.conf
chmod 640 $(CURDIR)/debian/zoneminder/etc/zm/zm.conf
override_dh_installinit:
dh_installinit --no-start
override_dh_apache2:
dh_apache2 --noenable
override_dh_strip:
[ -d "$(CURDIR)/debian/zoneminder-dbg" ] \
&& dh_strip --dbg-package=zoneminder-dbg \
|| dh_strip
#%:
# dh $@ --parallel --buildsystem=autoconf --with autoreconf
#
#override_dh_auto_configure:
# dh_auto_configure -- \
# --sysconfdir=/etc/zm \
# --with-mysql=/usr \
# --with-webdir=/usr/share/zoneminder \
# --with-ffmpeg=/usr \
# --with-cgidir=/usr/lib/cgi-bin \
# --with-webuser=www-data \
# --with-webgroup=www-data \
# --enable-mmap=yes

View File

@ -0,0 +1,28 @@
--- distros/ubuntu1204/rules
+++ distros/ubuntu1204/rules
@@ -58,8 +58,10 @@ override_dh_auto_install:
override_dh_fixperms:
dh_fixperms
- ## 637685
- chmod -c o-r $(CURDIR)/debian/zoneminder/etc/zm/zm.conf
+ #
+ # As requested by the Debian Webapps Policy Manual §3.2.1
+ chown root:www-data debian/zoneminder-core/etc/zm/zm.conf
+ chmod 640 debian/zoneminder-core/etc/zm/zm.conf
override_dh_installinit:
dh_installinit --no-start
--- distros/ubuntu1204/rules
+++ distros/ubuntu1204/rules
@@ -60,8 +60,8 @@ override_dh_fixperms:
dh_fixperms
#
# As requested by the Debian Webapps Policy Manual §3.2.1
- chown root:www-data debian/zoneminder-core/etc/zm/zm.conf
- chmod 640 debian/zoneminder-core/etc/zm/zm.conf
+ chown root:www-data $(CURDIR)/debian/zoneminder/etc/zm/zm.conf
+ chmod 640 $(CURDIR)/debian/zoneminder/etc/zm/zm.conf
override_dh_installinit:
dh_installinit --no-start

95
distros/ubuntu1604/rules.orig Executable file
View File

@ -0,0 +1,95 @@
#!/usr/bin/make -f
# -*- makefile -*-
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_LDFLAGS_MAINT_APPEND += -Wl,--as-needed
ifeq ($(DEB_BUILD_ARCH_OS),hurd)
ARGS:= -DZM_NO_MMAP=ON
endif
%:
dh $@ --parallel --buildsystem=cmake --builddirectory=dbuild \
--with systemd,sphinxdoc,apache2,linktree
override_dh_auto_configure:
dh_auto_configure -- $(ARGS) \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DCMAKE_BUILD_TYPE=Release \
-DZM_CONFIG_DIR="/etc/zm" \
-DZM_RUNDIR="/var/run/zm" \
-DZM_SOCKDIR="/var/run/zm" \
-DZM_TMPDIR="/tmp/zm" \
-DZM_CGIDIR="/usr/lib/zoneminder/cgi-bin" \
-DZM_CONTENTDIR="/var/cache/zoneminder"
override_dh_clean:
dh_clean $(MANPAGES1)
$(RM) -r docs/_build docs/installationguide
build-indep:
#$(MAKE) -C docs text
$(MAKE) -C docs html
MANPAGES1 = dbuild/scripts/zmupdate.pl.1
$(MANPAGES1):
# generate man page(s):
pod2man -s1 --stderr --utf8 $(patsubst %.1, %, $@) $@
## reproducible build:
LAST_CHANGE=$(shell dpkg-parsechangelog -S Date)
BUILD_DATE=$(shell LC_ALL=C date -u "+%B %d, %Y" -d "$(LAST_CHANGE)")
override_dh_installman: $(MANPAGES1)
$(MAKE) -C docs man SPHINXOPTS="-D today=\"$(BUILD_DATE)\""
dh_installman --language=C $(MANPAGES1)
override_dh_auto_install:
dh_auto_install --destdir=$(CURDIR)/debian/tmp
# remove worthless files:
$(RM) -v $(CURDIR)/debian/tmp/usr/share/perl5/*/*/*/.packlist
$(RM) -v $(CURDIR)/debian/tmp/usr/share/perl5/*/*.in
# remove empty directories:
find $(CURDIR)/debian/tmp/usr -type d -empty -delete -printf 'removed %p\n'
# remove extra-license-file:
$(RM) -v $(CURDIR)/debian/tmp/usr/share/zoneminder/www/api/lib/Cake/LICENSE.txt
override_dh_fixperms:
dh_fixperms
#
# As requested by the Debian Webapps Policy Manual §3.2.1
chown root:www-data $(CURDIR)/debian/zoneminder/etc/zm/zm.conf
chmod 640 $(CURDIR)/debian/zoneminder/etc/zm/zm.conf
override_dh_installinit:
dh_installinit --no-start
override_dh_systemd_start:
dh_systemd_start --no-start
override_dh_systemd_enable:
dh_systemd_enable --no-enable
override_dh_apache2:
dh_apache2 --noenable
override_dh_strip:
[ -d "$(CURDIR)/debian/zoneminder-dbg" ] \
&& dh_strip --dbg-package=zoneminder-dbg \
|| dh_strip
#%:
# dh $@ --parallel --buildsystem=autoconf --with autoreconf
#
#override_dh_auto_configure:
# dh_auto_configure -- \
# --sysconfdir=/etc/zm \
# --with-mysql=/usr \
# --with-webdir=/usr/share/zoneminder \
# --with-ffmpeg=/usr \
# --with-cgidir=/usr/lib/cgi-bin \
# --with-webuser=www-data \
# --with-webgroup=www-data \
# --enable-mmap=yes

View File

@ -0,0 +1,28 @@
--- distros/ubuntu1604/rules
+++ distros/ubuntu1604/rules
@@ -58,8 +58,10 @@ override_dh_auto_install:
override_dh_fixperms:
dh_fixperms
- ## 637685
- chmod -c o-r $(CURDIR)/debian/zoneminder/etc/zm/zm.conf
+ #
+ # As requested by the Debian Webapps Policy Manual §3.2.1
+ chown root:www-data debian/zoneminder-core/etc/zm/zm.conf
+ chmod 640 debian/zoneminder-core/etc/zm/zm.conf
override_dh_installinit:
dh_installinit --no-start
--- distros/ubuntu1604/rules
+++ distros/ubuntu1604/rules
@@ -60,8 +60,8 @@ override_dh_fixperms:
dh_fixperms
#
# As requested by the Debian Webapps Policy Manual §3.2.1
- chown root:www-data debian/zoneminder-core/etc/zm/zm.conf
- chmod 640 debian/zoneminder-core/etc/zm/zm.conf
+ chown root:www-data $(CURDIR)/debian/zoneminder/etc/zm/zm.conf
+ chmod 640 $(CURDIR)/debian/zoneminder/etc/zm/zm.conf
override_dh_installinit:
dh_installinit --no-start

View File

@ -1,17 +0,0 @@
--- a/packpack/pack/rpm.mk 2017-01-14 14:01:50.364217882 -0600
+++ b/packpack/pack/rpm.mk 2017-01-14 14:01:19.594985311 -0600
@@ -23,11 +23,13 @@
-e 's/Release:\([ ]*\).*/Release: $(RELEASE)%{dist}/' \
-e 's/Source0:\([ ]*\).*/Source0: $(TARBALL)/' \
-e 's/%setup .*/%setup -q -n $(PRODUCT)-$(VERSION)/' \
+ -e 's/%autosetup -n .*/%autosetup -n $(PRODUCT)-$(VERSION)/' \
-i $@.tmp
grep -F "Version: $(VERSION)" $@.tmp && \
grep -F "Release: $(RELEASE)" $@.tmp && \
grep -F "Source0: $(TARBALL)" $@.tmp && \
- grep -F "%setup -q -n $(PRODUCT)-$(VERSION)" $@.tmp || \
+ (grep -F "%setup -q -n $(PRODUCT)-$(VERSION)" $@.tmp || \
+ grep -F "%autosetup" $@.tmp) || \
(echo "Failed to patch RPM spec" && exit 1)
@ mv -f $@.tmp $@
@echo

View File

@ -1,11 +0,0 @@
--- a/packpack/pack/deb.mk 2017-01-15 16:41:32.938418279 -0600
+++ b/packpack/pack/deb.mk 2017-02-16 15:44:43.267900717 -0600
@@ -14,7 +14,7 @@
DPKG_BUILD:=$(PRODUCT)_$(DEB_VERSION)-$(RELEASE)_$(DPKG_ARCH).build
DPKG_DSC:=$(PRODUCT)_$(DEB_VERSION)-$(RELEASE).dsc
DPKG_ORIG_TARBALL:=$(PRODUCT)_$(DEB_VERSION).orig.tar.$(TARBALL_COMPRESSOR)
-DPKG_DEBIAN_TARBALL:=$(PRODUCT)_$(DEB_VERSION)-$(RELEASE).debian.tar.$(TARBALL_COMPRESSOR)
+DPKG_DEBIAN_TARBALL:=$(PRODUCT)_$(DEB_VERSION)-$(RELEASE).tar.$(TARBALL_COMPRESSOR)
# gh-7: Ubuntu/Debian should export DEBIAN_FRONTEND=noninteractive
export DEBIAN_FRONTEND=noninteractive

Binary file not shown.

15
utils/packpack/installzm.sh Executable file
View File

@ -0,0 +1,15 @@
#!/bin/bash
# No longer needed. This was incorporated into startpackpack.sh
# Required, so that Travis marks the build as failed if any of the steps below fail
set -ev
# Install and test the zoneminder package (only) for Ubuntu Trusty
if [ ${OS} == "ubuntu" ] && [ ${DIST} == "trusty" ]; then
sudo gdebi --non-interactive build/zoneminder_*amd64.deb
sudo chmod 644 /etc/zm/zm.conf
mysql -uzmuser -pzmpass zm < db/test.monitor.sql
sudo /usr/bin/zmpkg.pl start
sudo /usr/bin/zmfilter.pl -f purgewhenfull
fi

37
utils/packpack/rsync_xfer.sh Executable file
View File

@ -0,0 +1,37 @@
#!/bin/bash
# Required, so that Travis marks the build as failed if any of the steps below fail
set -ev
# Check to see if this script has access to all the commands it needs
for CMD in sshfs rsync find fusermount mkdir; do
type $CMD 2>&1 > /dev/null
if [ $? -ne 0 ]; then
echo
echo "ERROR: The script cannot find the required command \"${CMD}\"."
echo
exit 1
fi
done
# We only want to deploy packages during cron events
# See https://docs.travis-ci.com/user/cron-jobs/
if [ "${TRAVIS_EVENT_TYPE}" == "cron" ]; then
mkdir -p ./zmrepo
ssh_mntchk="$(sshfs zmrepo@zmrepo.zoneminder.com:./ ./zmrepo -o workaround=rename,reconnect)"
if [ -z "$ssh_mntchk" ]; then
# Don't keep packages older than 5 days
find ./zmrepo -maxdepth 1 -type f -mtime +5 -delete
rsync --ignore-errors ./build/ ./zmrepo/
fusermount -zu zmrepo
else
echo
echo "ERROR: Attempt to mount zmrepo.zoneminder.com failed!"
echo "sshfs gave the following error message:"
echo \"$ssh_mntchk\"
echo
fi
fi

View File

@ -2,97 +2,71 @@
# packpack setup file for the ZoneMinder project
# Written by Andrew Bauer
# Check to see if this script has access to all the commands it needs
for CMD in set echo curl repoquery git ln mkdir patch rmdir; do
type $CMD 2>&1 > /dev/null
###############
# SUBROUTINES #
###############
if [ $? -ne 0 ]; then
echo
echo "ERROR: The script cannot find the required command \"${CMD}\"."
echo
exit $?
fi
done
# General sanity checks
checksanity () {
# Check to see if this script has access to all the commands it needs
for CMD in set echo curl repoquery git ln mkdir rmdir; do
type $CMD 2>&1 > /dev/null
# Verify OS & DIST environment variables have been set before calling this script
if [ -z "${OS}" ] || [ -z "${DIST}" ]; then
echo "ERROR: both OS and DIST environment variables must be set"
exit 1
fi
if [ $? -ne 0 ]; then
echo
echo "ERROR: The script cannot find the required command \"${CMD}\"."
echo
exit 1
fi
done
# Verify OS & DIST environment variables have been set before calling this script
if [ -z "${OS}" ] || [ -z "${DIST}" ]; then
echo "ERROR: both OS and DIST environment variables must be set"
exit 1
fi
if [ -z "${ARCH}" ]; then
ARCH="x86_64"
fi
if [[ "${ARCH}" != "x86_64" && "${ARCH}" != "i386" && "${ARCH}" != "armhf" ]]; then
echo
echo "ERROR: Unsupported architecture specified \"${ARCH}\"."
echo
exit 1
fi
}
# Steps common to all builds
mkdir -p build
if [ -e "packpack/Makefile" ]; then
echo "Checking packpack github repo for changes..."
git -C packpack pull origin master
else
echo "Cloning pakcpack github repo..."
git clone https://github.com/packpack/packpack.git packpack
fi
# The rpm specfile requires we download the tarball and manually move it into place
# Might as well do this for Debian as well, rather than git submodule init
CRUDVER="3.0.10"
if [ -e "build/crud-${CRUDVER}.tar.gz" ]; then
echo "Found existing Crud ${CRUDVER} tarball..."
else
echo "Retrieving Crud ${CRUDVER} submodule..."
curl -L https://github.com/FriendsOfCake/crud/archive/v${CRUDVER}.tar.gz > build/crud-${CRUDVER}.tar.gz
if [ $? -ne 0 ]; then
echo "ERROR: Crud tarball retreival failed..."
exit $?
fi
fi
# Steps common to Redhat distros
if [ "${OS}" == "el" ] || [ "${OS}" == "fedora" ]; then
echo "Begin Redhat build..."
# %autosetup support has been merged upstream. No need to patch
#patch -p1 < utils/packpack/autosetup.patch
ln -sf distros/redhat rpm
# The rpm specfile requires the Crud submodule folder to be empty
if [ -e "web/api/app/Plugin/Crud/LICENSE.txt" ]; then
rm -rf web/api/app/Plugin/Crud
mkdir web/api/app/Plugin/Crud
fi
if [ "${OS}" == "el" ]; then
zmrepodistro=${OS}
commonprep () {
mkdir -p build
if [ -e "packpack/Makefile" ]; then
echo "Checking packpack github repo for changes..."
git -C packpack pull origin master
else
zmrepodistro="f"
echo "Cloning pakcpack github repo..."
git clone https://github.com/packpack/packpack.git packpack
fi
# Let repoquery determine the full url and filename of the zmrepo rpm we are interested in
result=`repoquery --repofrompath=zmpackpack,https://zmrepo.zoneminder.com/${zmrepodistro}/${DIST}/x86_64/ --repoid=zmpackpack --qf="%{location}" zmrepo 2> /dev/null`
if [ -n "$result" ] && [ $? -eq 0 ]; then
echo "Retrieving ZMREPO rpm..."
curl $result > build/zmrepo.noarch.rpm
# The rpm specfile requires we download the tarball and manually move it into place
# Might as well do this for Debian as well, rather than git submodule init
CRUDVER="3.0.10"
if [ -e "build/crud-${CRUDVER}.tar.gz" ]; then
echo "Found existing Crud ${CRUDVER} tarball..."
else
echo "ERROR: Failed to retrieve zmrepo rpm..."
if [ $? -ne 0 ]; then
echo $?
else
echo 1
echo "Retrieving Crud ${CRUDVER} submodule..."
curl -L https://github.com/FriendsOfCake/crud/archive/v${CRUDVER}.tar.gz > build/crud-${CRUDVER}.tar.gz
if [ $? -ne 0 ]; then
echo "ERROR: Crud tarball retreival failed..."
exit 1
fi
fi
}
echo "Starting packpack..."
packpack/packpack -f utils/packpack/redhat_package.mk redhat_package
# Steps common the Debian based distros
elif [ "${OS}" == "debian" ] || [ "${OS}" == "ubuntu" ]; then
echo "Begin Debian build..."
# patch packpack to remove "debian" from the source tarball filename
patch --dry-run --silent -f -p1 < utils/packpack/deb.mk.patch 2>/dev/null
if [ $? -eq 0 ]; then
patch -p1 < utils/packpack/deb.mk.patch
fi
# Uncompress the Crud tarball and move it into place
# Uncompress the Crud tarball and move it into place
movecrud () {
if [ -e "web/api/app/Plugin/Crud/LICENSE.txt" ]; then
echo "Crud plugin already installed..."
else
@ -101,17 +75,151 @@ elif [ "${OS}" == "debian" ] || [ "${OS}" == "ubuntu" ]; then
rmdir web/api/app/Plugin/Crud
mv -f crud-${CRUDVER} web/api/app/Plugin/Crud
fi
}
if [ ${DIST} == "trusty" ] || [ ${DIST} == "precise" ]; then
ln -sf distros/ubuntu1204 debian
elif [ ${DIST} == "wheezy" ]; then
ln -sf distros/debian debian
else
ln -sf distros/ubuntu1604 debian
# previsouly part of installzm.sh
# install the trusty deb and test zoneminder
installtrusty () {
# Check we've got gdebi installed
type gdebi 2>&1 > /dev/null
if [ $? -ne 0 ]; then
echo
echo "ERROR: The script cannot find the required command \"gdebi\"."
echo
exit 1
fi
# Install and test the zoneminder package (only) for Ubuntu Trusty
pkgname="build/zoneminder_${VERSION}-${RELEASE}_amd64.deb"
if [ -e $pkgname ]; then
sudo gdebi --non-interactive $pkgname
mysql -uzmuser -pzmpass zm < db/test.monitor.sql
sudo /usr/bin/zmpkg.pl start
sudo /usr/bin/zmfilter.pl -f purgewhenfull
else
echo
echo "ERROR: The script cannot find the package $pkgname"
echo "Check the Travis log for a build failure."
echo
exit 99
fi
}
# This sets the naming convention for the deb packages
setdebpkgver () {
# Set VERSION to x.xx.x+x e.g. 1.30.2+15
# the last x is number of commits since release
# Creates zoneminder packages in the format: zoneminder-{version}-{release}
zmver=$(git describe --long --always | sed -n 's/^\([0-9\.]*\)-\([0-9]*\)-\([a-z0-9]*\)/\1/p')
commitnum=$(git describe --long --always | sed -n 's/^\([0-9\.]*\)-\([0-9]*\)-\([a-z0-9]*\)/\2/p')
export VERSION="$zmver+$commitnum"
export RELEASE="${DIST}"
echo
echo "Packpack VERSION has been set to: ${VERSION}"
echo "Packpack RELEASE has been set to: ${RELEASE}"
echo
}
################
# MAIN PROGRAM #
################
checksanity
# We don't want to build packages for all supported distros after every commit
# Only build all packages when executed via cron
# See https://docs.travis-ci.com/user/cron-jobs/
if [ "${TRAVIS_EVENT_TYPE}" == "cron" ] || [ "${TRAVIS}" != "true" ]; then
commonprep
# Steps common to Redhat distros
if [ "${OS}" == "el" ] || [ "${OS}" == "fedora" ]; then
echo "Begin Redhat build..."
# Set VERSION to x.xx.x e.g. 1.30.2
# Set RELEASE to x where x is number of commits since release
# Creates zoneminder packages in the format: zoneminder-{version}-{release}
export VERSION=$(git describe --long --always | sed -n 's/^\([0-9\.]*\)-\([0-9]*\)-\([a-z0-9]*\)/\1/p')
export RELEASE=$(git describe --long --always | sed -n 's/^\([0-9\.]*\)-\([0-9]*\)-\([a-z0-9]*\)/\2/p')
echo
echo "Packpack VERSION has been set to: ${VERSION}"
echo "Packpack RELEASE has been set to: ${RELEASE}"
echo
ln -sfT distros/redhat rpm
# The rpm specfile requires the Crud submodule folder to be empty
rm -rf web/api/app/Plugin/Crud
mkdir web/api/app/Plugin/Crud
if [ "${OS}" == "el" ]; then
zmrepodistro=${OS}
else
zmrepodistro="f"
fi
# Let repoquery determine the full url and filename of the zmrepo rpm we are interested in
result=`repoquery --repofrompath=zmpackpack,https://zmrepo.zoneminder.com/${zmrepodistro}/"${DIST}"/x86_64/ --repoid=zmpackpack --qf="%{location}" zmrepo 2> /dev/null`
if [ -n "$result" ] && [ $? -eq 0 ]; then
echo "Retrieving ZMREPO rpm..."
curl $result > build/zmrepo.noarch.rpm
else
echo "ERROR: Failed to retrieve zmrepo rpm..."
exit 1
fi
echo "Starting packpack..."
packpack/packpack -f utils/packpack/redhat_package.mk redhat_package
# Steps common to Debian based distros
elif [ "${OS}" == "debian" ] || [ "${OS}" == "ubuntu" ]; then
echo "Begin ${OS} ${DIST} build..."
setdebpkgver
movecrud
if [ "${DIST}" == "trusty" ] || [ "${DIST}" == "precise" ]; then
ln -sfT distros/ubuntu1204 debian
elif [ "${DIST}" == "wheezy" ]; then
ln -sfT distros/debian debian
else
ln -sfT distros/ubuntu1604 debian
fi
echo "Starting packpack..."
packpack/packpack
if [ "${OS}" == "ubuntu" ] && [ "${DIST}" == "trusty" ] && [ "${ARCH}" == "x86_64" ] && [ "${TRAVIS}" == "true" ]; then
installtrusty
fi
fi
# We were not triggered via cron so just build and test trusty
elif [ "${OS}" == "ubuntu" ] && [ "${DIST}" == "trusty" ] && [ "${ARCH}" == "x86_64" ]; then
echo "Begin Ubuntu Trusty build..."
commonprep
setdebpkgver
movecrud
ln -sfT distros/ubuntu1204 debian
echo "Starting packpack..."
packpack/packpack
# If we are running inside Travis then attempt to install the deb we just built
if [ "${TRAVIS}" == "true" ]; then
installtrusty
fi
fi
exit 0

View File

@ -11,5 +11,8 @@ configure_file(app/Config/database.php.default "${CMAKE_CURRENT_BINARY_DIR}/app/
# Configure core.php
configure_file(app/Config/core.php.default "${CMAKE_CURRENT_BINARY_DIR}/app/Config/core.php" @ONLY)
# Configure bootstrap.php
# Configure app/Config/bootstrap.php
configure_file(app/Config/bootstrap.php.in "${CMAKE_CURRENT_BINARY_DIR}/app/Config/bootstrap.php" @ONLY)
# Configure lib/Cake/bootstrap.php
configure_file(lib/Cake/bootstrap.php.in "${CMAKE_CURRENT_BINARY_DIR}/lib/Cake//bootstrap.php" @ONLY)

View File

@ -18,6 +18,9 @@
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
// Force Cake's temp folder = ZoneMinder's temp folder
define('TMP', '@ZM_TMPDIR@');
define('TIME_START', microtime(true));
if (!defined('E_DEPRECATED')) {