summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandros Michalopoulos2018-10-03 20:31:42 +0300
committerAlexandros Michalopoulos2018-10-03 20:31:42 +0300
commit3f5991574e59a8fe9250860edb6d13bb6c522c37 (patch)
treef060aee95ab4d2a5c42cb7993f1e1f9bd1789677
parent1e837bdf49dd194445de6012006277e194a1fff1 (diff)
downloadaur-3f5991574e59a8fe9250860edb6d13bb6c522c37.tar.gz
v=1.32.1,r=2
-rw-r--r--.SRCINFO7
-rw-r--r--PKGBUILD51
-rw-r--r--zoneminder.install104
3 files changed, 84 insertions, 78 deletions
diff --git a/.SRCINFO b/.SRCINFO
index c2a78641220..23aef170a03 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,8 +1,8 @@
pkgbase = zoneminder
- pkgdesc = Free and open source CCTV software which supports IP, USB and analog cameras
+ pkgdesc = A full-featured, open source, state-of-the-art video surveillance software system.
pkgver = 1.32.1
- pkgrel = 1
- url = http://www.zoneminder.com
+ pkgrel = 2
+ url = https://zoneminder.com/
install = zoneminder.install
arch = x86_64
license = GPLv2
@@ -37,7 +37,6 @@ pkgbase = zoneminder
depends = perl-xml-parser
depends = perl-lwp-protocol-https
depends = perl-json-maybexs
- depends = perl-module-load-conditional
depends = perl-net-sftp-foreign
depends = perl-php-serialization
depends = perl-sys-cpu
diff --git a/PKGBUILD b/PKGBUILD
index ca8f324bc82..2a54e84c4a2 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -38,10 +38,10 @@
pkgname=zoneminder
pkgver=1.32.1
-pkgrel=1
-pkgdesc='Free and open source CCTV software which supports IP, USB and analog cameras'
+pkgrel=2
+pkgdesc='A full-featured, open source, state-of-the-art video surveillance software system.'
arch=('x86_64')
-url='http://www.zoneminder.com'
+url='https://zoneminder.com/'
license=('GPLv2')
depends=('polkit' 'ffmpeg' 'libmp4v2'
'mariadb' 'nginx-mainline' 'fcgiwrap' 'php-apcu' 'php-fpm' 'php-gd'
@@ -49,12 +49,12 @@ depends=('polkit' 'ffmpeg' 'libmp4v2'
'perl-json-any' 'perl-libwww' 'perl-mime-lite' 'perl-mime-tools' 'perl-number-bytes-human' 'perl-sys-meminfo' 'perl-sys-mmap'
# Needed for ONVIF support
'perl-class-load' 'perl-data-uuid' 'perl-io-socket-multicast' 'perl-soap-wsdl' 'perl-xml-parser'
- # Needed for SSL support (otherwise zmupdate.pl complains there is no HTTPS support)
+ # Needed for SSL support
'perl-lwp-protocol-https'
# Apparently needed for Telemetry support
'perl-json-maybexs'
# Unverified dependencies. So far not installing them hasn't raised any red flags, but I can't be 100% sure whether they're leftovers from previous ZoneMinder incarnations or if they're needed for proper operation during runtime, so for the time being I'm leaving them in.
- 'perl-module-load-conditional' 'perl-net-sftp-foreign' 'perl-php-serialization' 'perl-sys-cpu' 'perl-uri-encode')
+ 'perl-net-sftp-foreign' 'perl-php-serialization' 'perl-sys-cpu' 'perl-uri-encode')
makedepends=('cmake')
optdepends=('vlc: provides libvlc (may achieve better performance with some cameras)'
'ffmpeg-full: provides libavresample (dropped from the official ffmpeg package)')
@@ -82,6 +82,9 @@ prepare () {
# Move extra PHP plugins into place
cp -R $srcdir/crud-3.2.0/* web/api/app/Plugin/Crud
cp -R $srcdir/CakePHP-Enum-Behavior-1.0-zm/* web/api/app/Plugin/CakePHP-Enum-Behavior
+
+ # Fix the launcher
+ sed -i 's|localhost/zm|localhost:8095|g' misc/$pkgname.desktop.in
}
build() {
@@ -113,14 +116,10 @@ package() {
chown root:polkitd $pkgdir/usr/share/polkit-1/rules.d
# Create ZM_LOGDIR
- mkdir -p $pkgdir/var/log/$pkgname
- chown -R http:http $pkgdir/var/log/$pkgname
- chmod -R 775 $pkgdir/var/log/$pkgname
+ install -dm775 -o http -g http $pkgdir/var/log/$pkgname
# Create ZM_CONTENTDIR and its subfolders
- mkdir -p $pkgdir/var/lib/$pkgname/{cache,events,images,temp}
- chown -R http:http $pkgdir/var/lib/$pkgname
- chmod -R 775 $pkgdir/var/lib/$pkgname
+ install -dm775 -o http -g http $pkgdir/var/lib/$pkgname/{cache,events,images,temp}
# Run script provided by upstream to create and/or link the needed folders with proper permissions
./zmlinkcontent.sh -z $pkgdir/etc/$pkgname/zm.conf -w $pkgdir/srv/$pkgname/www -l $pkgdir/var/log/$pkgname -t $pkgdir/var/lib/$pkgname/temp $pkgdir/var/lib/$pkgname
@@ -135,24 +134,24 @@ package() {
chmod 644 $pkgdir/etc/$pkgname/zm.conf
chmod 644 $pkgdir/etc/$pkgname/conf.d/*
- # Install Nginx configuration
- mkdir -p $pkgdir/etc/nginx/sites-{available,enabled}
- install -D -m 644 $srcdir/$pkgname-nginx.conf $pkgdir/etc/nginx/sites-available/$pkgname.conf
- ln -s /etc/nginx/sites-available/$pkgname.conf $pkgdir/etc/nginx/sites-enabled/$pkgname.conf
+ # Setup Nginx
+ install -Dm644 $srcdir/$pkgname-nginx.conf $pkgdir/etc/nginx/sites-available/$pkgname.conf
+ install -dm755 $pkgdir/etc/nginx/sites-enabled
+ ln -s /etc/nginx/sites-available/$pkgname.conf $pkgdir/etc/nginx/sites-enabled/$pkgname.conf
+
+ # Setup PHP-FPM
+ install -Dm644 $srcdir/$pkgname-php.ini $pkgdir/etc/php/conf.d/$pkgname.ini
- # Install PHP-FPM custom .ini file
- mkdir -p $pkgdir/etc/php/conf.d/
- install -D -m 644 $srcdir/$pkgname-php.ini $pkgdir/etc/php/conf.d/$pkgname.ini
+ # Setup systemd service
+ install -Dm644 $srcdir/$pkgname.service $pkgdir/usr/lib/systemd/system/$pkgname.service
- # Install systemd service
- mkdir -p $pkgdir/usr/lib/systemd/system
- install -D -m 644 $srcdir/$pkgname.service $pkgdir/usr/lib/systemd/system/$pkgname.service
+ # Setup systemd tmpfile
+ install -Dm644 $srcdir/$pkgname-tmpfile.conf $pkgdir/usr/lib/tmpfiles.d/$pkgname.conf
- # Install systemd tmpfile
- mkdir -p $pkgdir/usr/lib/tmpfiles.d
- install -D -m 644 $srcdir/$pkgname-tmpfile.conf $pkgdir/usr/lib/tmpfiles.d/$pkgname.conf
+ # Setup logrotate
+ install -Dm644 misc/logrotate.conf $pkgdir/etc/logrotate.d/$pkgname
# Copy license and database schemas
- install -D -m 644 COPYING $pkgdir/usr/share/license/$pkgname
- install -D -m 644 db/zm*.sql $pkgdir/usr/share/$pkgname/db
+ install -Dm644 COPYING $pkgdir/usr/share/licenses/$pkgname/LICENSE
+ install -Dm644 db/zm*.sql $pkgdir/usr/share/$pkgname/db
}
diff --git a/zoneminder.install b/zoneminder.install
index 2bb7e8be126..4777e2d90a2 100644
--- a/zoneminder.install
+++ b/zoneminder.install
@@ -1,25 +1,61 @@
post_install() {
- systemctl daemon-reload
echo
+ systemctl daemon-reload
+
+
+ ### Nginx ###
+
+ # Configure it with the folder structure used in Debian-based distributions
+ if [ -f /etc/nginx/nginx.conf ]
+ then
+ if ( ! grep -q 'sites-enabled' /etc/nginx/nginx.conf )
+ then
+ sed -i 's|http {|http {\'$'\n include sites-enabled/*.conf;|g' /etc/nginx/nginx.conf
+ fi
+ systemctl is-active --quiet nginx && systemctl stop nginx
+ systemctl start nginx
+ fi
+
+
+ ### PHP-FPM ###
+
+ # Set local timezone in /etc/php/conf.d/zoneminder.ini
+ sed -i 's|PLACEHOLDER|'`timedatectl | grep "Time zone" | tr -s ' ' | cut -f4 -d ' '`'|g' /etc/php/conf.d/zoneminder.ini
+ systemctl is-active --quiet php-fpm && systemctl stop php-fpm
+ systemctl start php-fpm
+
+
+ ### fcgiwrap ###
+
+ systemctl is-active --quiet fcgiwrap.socket && systemctl stop fcgiwrap.socket
+ systemctl is-active --quiet fcgiwrap && systemctl stop fcgiwrap
+ systemctl start fcgiwrap.socket
+
+
### MariaDB ###
+ systemctl is-active --quiet mariadb && systemctl stop mariadb
+
# Initialize MariaDB's default database if it's not already initialized
if [ ! -d /var/lib/mysql/mysql ]
then
- systemctl is-active --quiet mariadb && systemctl stop mariadb
# NOTE: This will need to be changed when MariaDB 10.2 hits the repos, as mysql_install_db has been deprecated in favor of mysqld
mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql 2> /dev/null
fi
- systemctl is-active --quiet mariadb || systemctl start mariadb
+ systemctl start mariadb
+
+
+ ### ZoneMinder ###
# Create ZoneMinder's database & user if they do not exist
if [ ! -d /var/lib/mysql/zm ]
then
- # If a database root password is set
+ # Check for database root password
if [[ "$(mysql -uroot -e "select * from mysql.user;" 2>&1)" = *"Access denied"* ]]
then
+ # If a database root password is set
echo \* Secure MariaDB installation found, please enter the database root password when prompted.
echo
mysql -uroot -p < /usr/share/zoneminder/db/zm_create.sql
@@ -28,50 +64,19 @@ post_install() {
echo
mysql -uroot -p -e "grant select,insert,update,delete,create,alter,index,lock tables on zm.* to 'zmuser'@localhost identified by 'zmpass';"
echo
- # If a database root password is not set
else
+ # If a database root password is not set
mysql -uroot < /usr/share/zoneminder/db/zm_create.sql
mysql -uroot -e "grant select,insert,update,delete,create,alter,index,lock tables on zm.* to 'zmuser'@localhost identified by 'zmpass';"
fi
fi
-
- ### PHP-FPM ###
-
- # Set local timezone in /etc/php/conf.d/zoneminder.ini
- sed -i 's|PLACEHOLDER|'`timedatectl | grep "Time zone" | tr -s ' ' | cut -f4 -d ' '`'|g' /etc/php/conf.d/zoneminder.ini
- systemctl is-active --quiet php-fpm && systemctl stop php-fpm
- systemctl start php-fpm
-
-
- ### fcgiwrap ###
-
- systemctl is-active --quiet fcgiwrap.socket && systemctl stop fcgiwrap.socket && systemctl stop fcgiwrap
- systemctl start fcgiwrap.socket
-
-
- ### Nginx ###
-
- # Configure it with the folder structure used in Debian-based distributions
- if [ -f /etc/nginx/nginx.conf ]
- then
- if ( ! grep -q 'sites-enabled' /etc/nginx/nginx.conf )
- then
- sed -i 's|http {|http {\'$'\n include sites-enabled/*.conf;|g' /etc/nginx/nginx.conf
- fi
- systemctl is-active --quiet nginx && systemctl stop nginx
- systemctl start nginx
- fi
-
-
- ### ZoneMinder
-
- # Also activate the tmpfile to create runtime directories
systemctl is-active --quiet zoneminder && systemctl stop zoneminder
systemd-tmpfiles --create
systemctl start zoneminder
- echo Done!
+
+ echo ---------------
echo
echo ZoneMinder is listening at http://localhost:8095
echo
@@ -80,20 +85,23 @@ post_install() {
post_upgrade() {
post_install
- # Make sure ZoneMinder is running before we attempt to use its updater
- if ( systemctl is-active --quiet zoneminder )
- then
- /usr/bin/zmupdate.pl -f 1> /dev/null
- else
- echo ---------------
- echo
- echo Error performing database update, zoneminder.service could not be started. Please fix any issues and manually run \'/usr/bin/zmupdater.pl -f\'
- echo
- fi
+ echo ---------------
+ echo
+ echo The ZoneMinder updater will now run.
+
+ # Make sure ZoneMinder is *not* running before we attempt to use its updater
+ systemctl is-active --quiet zoneminder && systemctl stop zoneminder
+ /usr/bin/zmupdate.pl -f
+ systemctl start zoneminder
+
+ echo
+ echo Update complete.
+ echo
}
post_remove() {
systemctl daemon-reload && systemctl is-active --quiet zoneminder && systemctl stop zoneminder
+
echo
echo ZoneMinder\'s database and user have been left intact. You can remove them by running the following:
echo