Skip to content

Commit

Permalink
Merge pull request #240 from ZoneMinder/postinstcleanup
Browse files Browse the repository at this point in the history
remove extra stuff that I don't think we need because we are the source.
  • Loading branch information
connortechnology committed Nov 19, 2013
2 parents 6a23a05 + a1cb1e6 commit 4555a8b
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 45 deletions.
6 changes: 6 additions & 0 deletions distros/ubuntu1204/changelog
@@ -1,3 +1,9 @@
zoneminder (1.26.4+1-SNAPSHOT2013110302) precise; urgency=high

* Today's snapshot of master

-- Isaac Connor <iconnor@connortechnology.com> Sun, 03 Nov 2013 14:05:46 -0500

zoneminder (1.26.4-2) precise; urgency=high

* improvements to zmupdate.pl, cleanups
Expand Down
63 changes: 24 additions & 39 deletions distros/ubuntu1204/postinst
Expand Up @@ -2,44 +2,32 @@

set -e

VERSION=1.26.4

if [ "$1" = "configure" ]; then
#
# Get mysql started if it isn't
#
if ! $(/etc/init.d/mysql status >/dev/null 2>&1); then
invoke-rc.d mysql start
fi
if $(/etc/init.d/mysql status >/dev/null 2>&1); then
mysqladmin --defaults-file=/etc/mysql/debian.cnf -f reload
# test if database if already present...
if ! $(echo quit | mysql --defaults-file=/etc/mysql/debian.cnf zm > /dev/null 2> /dev/null) ; then
cat /usr/share/zoneminder/db/zm_create.sql | mysql --defaults-file=/etc/mysql/debian.cnf
echo 'grant lock tables, alter,select,insert,update,delete on zm.* to 'zmuser'@localhost identified by "zmpass";' | mysql --defaults-file=/etc/mysql/debian.cnf mysql
fi
#
# Get mysql started if it isn't
#
if ! $(/etc/init.d/mysql status >/dev/null 2>&1); then
invoke-rc.d mysql start
fi
if $(/etc/init.d/mysql status >/dev/null 2>&1); then
mysqladmin --defaults-file=/etc/mysql/debian.cnf -f reload
# test if database if already present...
if ! $(echo quit | mysql --defaults-file=/etc/mysql/debian.cnf zm > /dev/null 2> /dev/null) ; then
cat /usr/share/zoneminder/db/zm_create.sql | mysql --defaults-file=/etc/mysql/debian.cnf
echo 'grant lock tables, alter,select,insert,update,delete on zm.* to 'zmuser'@localhost identified by "zmpass";' | mysql --defaults-file=/etc/mysql/debian.cnf mysql
fi

# get old version from upgrade...
OLD_ZM_VERSION=${2%-*}
if [ -z "$OLD_ZM_VERSION" ]; then
# fall back to getting version from database itself, which may not necessarily be accurate?
OLD_ZM_VERSION=$(echo 'select Value from Config where Name = "ZM_DYN_CURR_VERSION";' | mysql --defaults-file=/etc/mysql/debian.cnf --skip-column-names zm )
fi
if [ -n "$OLD_ZM_VERSION" ] && [ "$OLD_ZM_VERSION" != "$VERSION" ] ; then
echo 'grant lock tables, create, alter on zm.* to 'zmuser'@localhost identified by "zmpass";' | mysql --defaults-file=/etc/mysql/debian.cnf mysql
# stop zoneminder before performing database upgrade.
invoke-rc.d zoneminder stop || true
zmupdate.pl --nointeractive --version $OLD_ZM_VERSION
fi
invoke-rc.d zoneminder stop || true
zmupdate.pl --nointeractive

else
echo 'NOTE: mysql not running, please start mysql and run dpkg-reconfigure zoneminder when it is running.'
fi
chown www-data:www-data /var/log/zm
chown www-data:www-data /var/lib/zm/
if [ -z "$2" ]; then
chown www-data:www-data -R /var/cache/zoneminder
fi
else
echo 'NOTE: mysql not running, please start mysql and run dpkg-reconfigure zoneminder when it is running.'
fi
chown www-data:www-data /var/log/zm
chown www-data:www-data /var/lib/zm/
if [ -z "$2" ]; then
chown www-data:www-data -R /var/cache/zoneminder
fi
fi
# Ensure zoneminder is stopped...
if [ -x "/etc/init.d/zoneminder" ]; then
Expand All @@ -55,10 +43,7 @@ if [ "$1" = "configure" ]; then
chown www-data:www-data -R /var/cache/zoneminder
else
chown www-data:www-data /var/log/zm
OLD_ZM_VERSION=${2%-*}
if [ "$OLD_ZM_VERSION" != "$VERSION" ] ; then
zmupdate.pl --version $OLD_ZM_VERSION
fi
zmupdate.pl
fi
fi
#DEBHELPER#
6 changes: 0 additions & 6 deletions distros/ubuntu1204/rules
Expand Up @@ -9,9 +9,6 @@
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

UPSTREAM_VERSION := $(shell dpkg-parsechangelog | egrep '^Version:' | cut -f 2 -d ' ' | cut -d - -f 1)
POSTINST_VERSION := $(shell egrep ^VERSION= debian/postinst | cut -d = -f 2)

# These are used for cross-compiling and for saving the configure script
# from having to guess our platform (since we know it already)
DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
Expand All @@ -34,9 +31,6 @@ override_dh_auto_configure:
CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --sysconfdir=/etc/zm --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info --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-crashtrace=no --enable-mmap=yes

override_dh_clean:
# check to make sure that postinst contains the correct upstream version
[ $(UPSTREAM_VERSION) = $(POSTINST_VERSION) ]

# Add here commands to clean up after the build process.
[ ! -f Makefile ] || $(MAKE) distclean
dh_clean
Expand Down

0 comments on commit 4555a8b

Please sign in to comment.