summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Michalopoulos2020-01-18 15:38:44 +0200
committerAlexander Michalopoulos2020-01-18 15:38:44 +0200
commit43d4d3410eb4ac2133d1101aa49324a26c672045 (patch)
tree8eca96708993226d070f61135c7c8b9726a772c2
parent9eed1a3ab974ac0348e5d13212439652cc929e0e (diff)
downloadaur-43d4d3410eb4ac2133d1101aa49324a26c672045.tar.gz
v=1.34.0,r=1 - Multiple breaking changes, details in the PKGBUILD'
-rw-r--r--.SRCINFO51
-rw-r--r--PKGBUILD167
-rw-r--r--zmsetup.sh159
-rw-r--r--zoneminder-httpd.conf16
-rw-r--r--zoneminder-nginx.conf2
-rw-r--r--zoneminder-php.ini2
-rw-r--r--zoneminder.install264
7 files changed, 342 insertions, 319 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 50cf2b61a91c..8242e3df1041 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,12 +1,13 @@
pkgbase = zoneminder
pkgdesc = A full-featured, open source, state-of-the-art video surveillance software system
- pkgver = 1.32.3
- pkgrel = 3
- url = https://zoneminder.com/
+ pkgver = 1.34.0
+ pkgrel = 1
+ url = https://www.zoneminder.com/
install = zoneminder.install
- arch = x86_64
+ arch = any
license = GPL2
makedepends = cmake
+ makedepends = git
depends = polkit
depends = ffmpeg
depends = libmp4v2
@@ -16,6 +17,7 @@ pkgbase = zoneminder
depends = perl-archive-zip
depends = perl-data-dump
depends = perl-date-manip
+ depends = perl-datetime
depends = perl-dbd-mysql
depends = perl-device-serialport
depends = perl-file-slurp
@@ -23,9 +25,13 @@ pkgbase = zoneminder
depends = perl-libwww
depends = perl-mime-lite
depends = perl-mime-tools
+ depends = perl-net-sftp-foreign
depends = perl-number-bytes-human
+ depends = perl-php-serialization
+ depends = perl-sys-cpu
depends = perl-sys-meminfo
depends = perl-sys-mmap
+ depends = perl-uri-encode
depends = perl-class-load
depends = perl-data-uuid
depends = perl-io-socket-multicast
@@ -33,39 +39,36 @@ pkgbase = zoneminder
depends = perl-xml-parser
depends = perl-lwp-protocol-https
depends = perl-json-maybexs
- depends = perl-net-sftp-foreign
- depends = perl-php-serialization
- depends = perl-sys-cpu
- depends = perl-uri-encode
- depends = nginx-mainline
- depends = fcgiwrap
- depends = spawn-fcgi
- depends = multiwatch
- depends = mariadb
- optdepends = apache: alternative web server
- optdepends = vlc: provides libvlc (may achieve better performance with some camera models)
+ depends = perl-crypt-eksblowfish
+ depends = perl-data-entropy
+ optdepends = mariadb
+ optdepends = apache
+ optdepends = nginx
+ optdepends = fcgiwrap: required if using nginx
+ optdepends = spawn-fcgi: required if using nginx
+ optdepends = multiwatch: required if using nginx
+ optdepends = pod2man: required for Docker support
+ optdepends = vlc: provides libvlc, may achieve better performance with some camera models
conflicts = zoneminder-git
backup = etc/nginx/sites-available/zoneminder.conf
backup = etc/httpd/conf/extra/zoneminder.conf
backup = etc/php/conf.d/zoneminder.ini
- source = https://github.com/ZoneMinder/ZoneMinder/archive/1.32.3.tar.gz
- source = https://github.com/FriendsOfCake/crud/archive/v3.2.0.tar.gz
- source = https://github.com/ZoneMinder/CakePHP-Enum-Behavior/archive/1.0-zm.tar.gz
+ source = git+https://github.com/ZoneMinder/zoneminder.git#tag=1.34.0
source = zoneminder-nginx.conf
source = zoneminder-httpd.conf
source = zoneminder-php.ini
source = zoneminder.service
source = zoneminder-tmpfile.conf
source = fcgiwrap-multiwatch.service
- sha256sums = 9a7e61c529a6269ff0344403369b160b8c8da48615c4172377c465da0b0074b1
- sha256sums = 55be29e1eccb44d4ad0db8b23c37cec50f5341f8e498583d472ed1f0493876e3
- sha256sums = dbd231e97b950c698f0f501d6a53c7291c9985e766b09e3afe00cfe69a969f44
- sha256sums = be503e5cedf42383122a1f96a6e00e25d473f8c1c536c000db748dbde12c88b0
- sha256sums = 0753527da658bb4025509c03923f21f7995cedb09008d64f1568fd1d5c2ec46b
- sha256sums = 479f290d3c92938cd929020ad140d613814b912b4302c2758be6446ebfb8a4ac
+ source = zmsetup.sh
+ sha256sums = SKIP
+ sha256sums = c60e855428a56cc327214aa13d02a70011bf3b63a94a0d845b1c5ea1fab28ad2
+ sha256sums = 1f0d2276861065caf0b6c030ba27a6edb6a2988c7a1ac0fdf4e8fcb856972715
+ sha256sums = 2d7f5ac073687be75c7724b0acd3785d8c358e4f65341e60d39eb6006f31389b
sha256sums = 3e4de227e3154dffa887f2286c339ab3cf456f6d74a400b2786192b7e2b129c0
sha256sums = b69ac1deaaf3cf84b4ae4dbab794e1b062823de817f1e3a816ccf5438db440c0
sha256sums = e95f9bef77aef647dd633bd9ad75dc099b6d7184684e133f2f20702de83a6260
+ sha256sums = ac92fc44d3b6a90eeeed42aaf1b4b992a45168db1eb5be48444c635d6c1d3ab6
pkgname = zoneminder
diff --git a/PKGBUILD b/PKGBUILD
index e0aadcba310e..3434997e183e 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -14,101 +14,98 @@
-### Important notes for version 1.32.x ###
+
+### Important notes for version 1.34.x ###
+#
+# 1) From now on, this package will only install ZoneMinder itself. In other words, this means that after the setup is complete, ZoneMinder
+# will NOT be fully deployed and thus will NOT be able to function properly without manual intervention.
+#
+# As a bare minimum, on a fresh install you will also need to at least install and configure a MySQL-compatible server and a web server, as well
+# as perform some other small tweaks needed to finalize the setup (e.g. you will need to refresh systemd's tmpfiles and, if you'll be using Nginx,
+# you will also need to install and configure fcgiwrap, spawn-fcgi and multiwatch).
+#
+# For more detailed info on how to configure ZoneMinder, you should check the following links:
#
-# 1) git-clone for CakePHP and Crud sources was replaced with published precompiled packages, as follows:
-# - CakePHP-Enum-Behaviour is pulled from the ZoneMinder repo, because a change is needed that has not yet been merged upstream.
-# - Crud is pulled from its official repo, since Pull Request #582 has been merged as required by the ZoneMinder devs.
+# * https://wiki.archlinux.org/index.php/ZoneMinder
+# * https://zoneminder.readthedocs.io/en/latest/
#
-# 2) By default, ZoneMinder now runs at localhost:8095 instead of localhost/zm (this can be changed by editing the provided conf files).
+# Also, a separate script (zmsetup.sh) is now provided to help with automating the above procedure, if so desired.
#
-# 3) Apache was switched out in favor of Nginx, but remains as an optional dependency.
+# 2) As an extension to the above, there is now no hard dependency on either Apache, Nginx or MariaDB.
+#
+# 3) ZoneMinder's webroot has been relocated from /srv/zoneminder to /usr/share/webapps/zoneminder. The default configuration files have
+# been adjusted for this change, but if you've ever manually edited your local copies then they will not be automatically overwritten with the new
+# versions, which means updating to 1.34 will probably break your existing setup. Do look for any rogue .pacsave files in /etc after you update!
+#
+# Bug reports and packaging suggestions are always welcome at https://aur.archlinux.org/packages/zoneminder/
-#######################################################################################################################
-# #
-# If you're upgrading from a release older than 1.32.0: #
-# #
-# Due to the many breaking changes in new releases (both upstream and in the packaging), it's recommended to backup #
-# any existing ZoneMinder databases and perform a clean installation. Failure to do so may have very weird results. #
-# #
-#######################################################################################################################
pkgname=zoneminder
-pkgver=1.32.3
-pkgrel=3
+pkgver=1.34.0
+pkgrel=1
pkgdesc='A full-featured, open source, state-of-the-art video surveillance software system'
-arch=('x86_64')
-url='https://zoneminder.com/'
+arch=('any')
+url='https://www.zoneminder.com/'
license=('GPL2')
depends=('polkit' 'ffmpeg' 'libmp4v2'
'php-apcu' 'php-fpm' 'php-gd'
- 'perl-archive-zip' 'perl-data-dump' 'perl-date-manip' 'perl-dbd-mysql' 'perl-device-serialport' 'perl-file-slurp' 'perl-image-info'
- 'perl-libwww' 'perl-mime-lite' 'perl-mime-tools' 'perl-number-bytes-human' 'perl-sys-meminfo' 'perl-sys-mmap'
+ 'perl-archive-zip' 'perl-data-dump' 'perl-date-manip' 'perl-datetime' 'perl-dbd-mysql' 'perl-device-serialport' 'perl-file-slurp'
+ 'perl-image-info' 'perl-libwww' 'perl-mime-lite' 'perl-mime-tools' 'perl-net-sftp-foreign' 'perl-number-bytes-human' 'perl-php-serialization'
+ 'perl-sys-cpu' 'perl-sys-meminfo' 'perl-sys-mmap' 'perl-uri-encode'
# Needed for ONVIF support
'perl-class-load' 'perl-data-uuid' 'perl-io-socket-multicast' 'perl-soap-wsdl' 'perl-xml-parser'
# 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-net-sftp-foreign' 'perl-php-serialization' 'perl-sys-cpu' 'perl-uri-encode'
-
- # Remove the following line if you don't need Nginx
- 'nginx-mainline' 'fcgiwrap' 'spawn-fcgi' 'multiwatch'
-
- # Remove the following line if you don't need MariaDB
- 'mariadb'
-
+ # Needed for Telemetry support
+ 'perl-json-maybexs'
+ # Needed for encryption
+ 'perl-crypt-eksblowfish' 'perl-data-entropy'
)
-makedepends=('cmake')
-optdepends=('apache: alternative web server'
- 'vlc: provides libvlc (may achieve better performance with some camera models)')
+makedepends=('cmake' 'git')
+optdepends=('mariadb'
+ 'apache'
+ 'nginx'
+ 'fcgiwrap: required if using nginx'
+ 'spawn-fcgi: required if using nginx'
+ 'multiwatch: required if using nginx'
+ 'pod2man: required for Docker support'
+ 'vlc: provides libvlc, may achieve better performance with some camera models')
conflicts=('zoneminder-git')
backup=("etc/nginx/sites-available/$pkgname.conf"
"etc/httpd/conf/extra/$pkgname.conf"
"etc/php/conf.d/$pkgname.ini")
install=$pkgname.install
-source=("https://github.com/ZoneMinder/ZoneMinder/archive/$pkgver.tar.gz"
- "https://github.com/FriendsOfCake/crud/archive/v3.2.0.tar.gz"
- "https://github.com/ZoneMinder/CakePHP-Enum-Behavior/archive/1.0-zm.tar.gz"
+source=("git+https://github.com/ZoneMinder/zoneminder.git#tag=$pkgver"
"zoneminder-nginx.conf"
"zoneminder-httpd.conf"
"zoneminder-php.ini"
"zoneminder.service"
"zoneminder-tmpfile.conf"
- "fcgiwrap-multiwatch.service")
-sha256sums=('9a7e61c529a6269ff0344403369b160b8c8da48615c4172377c465da0b0074b1'
- '55be29e1eccb44d4ad0db8b23c37cec50f5341f8e498583d472ed1f0493876e3'
- 'dbd231e97b950c698f0f501d6a53c7291c9985e766b09e3afe00cfe69a969f44'
- # zoneminder-nginx.conf
- 'be503e5cedf42383122a1f96a6e00e25d473f8c1c536c000db748dbde12c88b0'
- # zoneminder-httpd.conf
- '0753527da658bb4025509c03923f21f7995cedb09008d64f1568fd1d5c2ec46b'
- # zoneminder-php.ini
- '479f290d3c92938cd929020ad140d613814b912b4302c2758be6446ebfb8a4ac'
- # zoneminder.service
+ "fcgiwrap-multiwatch.service"
+ "zmsetup.sh")
+sha256sums=('SKIP'
+ 'c60e855428a56cc327214aa13d02a70011bf3b63a94a0d845b1c5ea1fab28ad2'
+ '1f0d2276861065caf0b6c030ba27a6edb6a2988c7a1ac0fdf4e8fcb856972715'
+ '2d7f5ac073687be75c7724b0acd3785d8c358e4f65341e60d39eb6006f31389b'
'3e4de227e3154dffa887f2286c339ab3cf456f6d74a400b2786192b7e2b129c0'
- # zoneminder-tmpfile.conf
'b69ac1deaaf3cf84b4ae4dbab794e1b062823de817f1e3a816ccf5438db440c0'
- # fcgiwrap-multiwatch.service
- 'e95f9bef77aef647dd633bd9ad75dc099b6d7184684e133f2f20702de83a6260')
+ 'e95f9bef77aef647dd633bd9ad75dc099b6d7184684e133f2f20702de83a6260'
+ 'ac92fc44d3b6a90eeeed42aaf1b4b992a45168db1eb5be48444c635d6c1d3ab6')
prepare () {
- cd $pkgname-$pkgver
+ cd $pkgname
- # 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
+ # Download and move extra PHP plugins into place
+ git submodule update --init --recursive
# Fix the launcher
sed -i 's|localhost/zm|localhost:8095|g' misc/$pkgname.desktop.in
}
build() {
- cd $pkgname-$pkgver
+ cd $pkgname
cmake -DCMAKE_INSTALL_PREFIX=/usr \
-DZM_CONFIG_DIR=/etc/$pkgname \
@@ -119,65 +116,69 @@ build() {
-DZM_TMPDIR=/var/tmp/$pkgname \
-DZM_CONTENTDIR=/var/lib/$pkgname \
-DZM_CACHEDIR=/var/lib/$pkgname/cache \
- -DZM_WEBDIR=/srv/$pkgname/www \
- -DZM_CGIDIR=/srv/$pkgname/cgi-bin \
+ -DZM_WEBDIR=/usr/share/webapps/$pkgname/www \
+ -DZM_CGIDIR=/usr/share/webapps/$pkgname/cgi-bin \
-DZM_WEB_USER=http .
make
}
package() {
- cd $pkgname-$pkgver
+ cd $pkgname
make DESTDIR=$pkgdir install
# Set Polkit directory permissions in accordance with Arch policy
- chmod 750 $pkgdir/usr/share/polkit-1/rules.d
- chown root:polkitd $pkgdir/usr/share/polkit-1/rules.d
+ chmod 750 $pkgdir/usr/share/polkit-1/rules.d
+ chown root:polkitd $pkgdir/usr/share/polkit-1/rules.d
# Create ZM_LOGDIR
- install -dm775 -o http -g http $pkgdir/var/log/$pkgname
+ install -dm755 -o http -g http $pkgdir/var/log/$pkgname
# Create ZM_CONTENTDIR and its subfolders
- install -dm775 -o http -g http $pkgdir/var/lib/$pkgname/{cache,events,images}
+ install -dm775 -o http -g http $pkgdir/var/lib/$pkgname/{cache,events,images}
# Link ZM_CGIDIR and ZM_CACHEDIR inside ZM_WEBDIR and set correct permissions
- ln -sf /srv/$pkgname/cgi-bin $pkgdir/srv/$pkgname/www
- ln -sf /var/lib/$pkgname/cache $pkgdir/srv/$pkgname/www
- chown -Rh http:http $pkgdir/srv/$pkgname
+ ln -sf /usr/share/webapps/$pkgname/cgi-bin $pkgdir/usr/share/webapps/$pkgname/www
+ ln -sf /var/lib/$pkgname/cache $pkgdir/usr/share/webapps/$pkgname/www
+ chown -Rh http:http $pkgdir/usr/share/webapps/$pkgname
# Link ZM_WEBDIR/api/app/tmp to ZM_TMPDIR
- ln -sf /var/tmp/$pkgname $pkgdir/srv/$pkgname/www/api/app/tmp
+ ln -sf /var/tmp/$pkgname $pkgdir/usr/share/webapps/$pkgname/www/api/app/tmp
# Temporary fix for hardcoded /zm/ links (credit goes to @Kubax on AUR)
- ln -sf /srv/$pkgname/www $pkgdir/srv/$pkgname/www/zm
+ ln -sf /usr/share/webapps/$pkgname/www $pkgdir/usr/share/webapps/$pkgname/www/zm
# Set correct permissions for ZM_CONFIG_DIR & ZM_CONFIG_SUBDIR
- chmod -R 755 $pkgdir/etc/$pkgname
- chmod 644 $pkgdir/etc/$pkgname/zm.conf
- chmod 644 $pkgdir/etc/$pkgname/conf.d/*
-
- # Install Nginx conf file
+ chmod -R 755 $pkgdir/etc/$pkgname
+ chmod 644 $pkgdir/etc/$pkgname/zm.conf
+ chmod 644 $pkgdir/etc/$pkgname/conf.d/*
+
+
+ # Nginx conf file
install -Dm644 $srcdir/$pkgname-nginx.conf $pkgdir/etc/nginx/sites-available/$pkgname.conf
- # Install Apache conf file
+ # Apache conf file
install -Dm644 $srcdir/$pkgname-httpd.conf $pkgdir/etc/httpd/conf/extra/$pkgname.conf
- # Install PHP-FPM ini file
- install -Dm644 $srcdir/$pkgname-php.ini $pkgdir/etc/php/conf.d/$pkgname.ini
-
- # Install systemd service
+ # systemd service
install -Dm644 $srcdir/$pkgname.service $pkgdir/usr/lib/systemd/system/$pkgname.service
- # Install systemd tmpfile
+ # systemd tmpfile
install -Dm644 $srcdir/$pkgname-tmpfile.conf $pkgdir/usr/lib/tmpfiles.d/$pkgname.conf
- # Install fcgiwrap-multiwatch service
+ # php.ini file
+ install -Dm644 $srcdir/$pkgname-php.ini $pkgdir/etc/php/conf.d/$pkgname.ini
+
+ # fcgiwrap-multiwatch service
install -Dm644 $srcdir/fcgiwrap-multiwatch.service $pkgdir/usr/lib/systemd/system/fcgiwrap-multiwatch.service
- # Install logrotate conf file
+ # zoneminder-setup.sh
+ install -Dm755 $srcdir/zmsetup.sh $pkgdir/usr/bin/zmsetup.sh
+
+ # logrotate conf file
install -Dm644 misc/logrotate.conf $pkgdir/etc/logrotate.d/$pkgname
- # Copy default database schemas
+ # database schemas
install -Dm644 db/zm*.sql $pkgdir/usr/share/$pkgname/db
}
diff --git a/zmsetup.sh b/zmsetup.sh
new file mode 100644
index 000000000000..d25fec23cbe9
--- /dev/null
+++ b/zmsetup.sh
@@ -0,0 +1,159 @@
+#!/usr/bin/bash
+
+choice="$1"
+
+echo "WARNING: This script is heavilly WIP. Caveat emptor."
+echo
+echo "Please report any bugs you find at https://aur.archlinux.org/packages/zoneminder/"
+echo
+
+if [[ $EUID -ne 0 ]]
+then
+ echo "ERROR: This script must be run as root."
+ exit 1
+fi
+
+case "$choice" in
+
+ --nginx )
+
+ systemctl daemon-reload
+
+ # Ensure Nginx, fcgiwrap, spawn-fcgi and multiwatch are installed
+ if [[ "$(pacman -Qs nginx)" = *"local/nginx"* ]] && [[ "$(pacman -Qs fcgiwrap)" = *"local/fcgiwrap"* ]] && [[ "$(pacman -Qs spawn-fcgi)" = *"local/spawn-fcgi"* ]] && [[ "$(pacman -Qs multiwatch)" = *"local/multiwatch"* ]]
+ then
+ # Ensure the main conf file is present
+ if [ -f /etc/nginx/nginx.conf ]
+ then
+ # Configure Nginx with the folder structure used in Debian-based distributions
+ 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
+
+ # Create the sites-enabled folder if it's not already created
+ if [ ! -d /etc/nginx/sites-enabled ]
+ then
+ mkdir -p /etc/nginx/sites-enabled
+ fi
+
+ # Enable ZoneMinder's server block if it's not already enabled
+ if [ ! -f /etc/nginx/sites-enabled/zoneminder.conf ]
+ then
+ ln -sf /etc/nginx/sites-{available,enabled}/zoneminder.conf
+ fi
+
+ # Start Nginx
+ systemctl is-active --quiet nginx && systemctl stop nginx
+ systemctl restart --quiet nginx && echo "* Nginx successfully configured"
+ else
+ echo "ERROR: Nginx is installed but /etc/nginx/nginx.conf was not found"
+ exit 1
+ fi
+
+ ### fcgiwrap ###
+
+ # By default fcgiwrap is configured to launch in 10 instances via spawn-fcgi and multiwatch. This should be
+ # enough for ZoneMinder to operate with 3 cameras. If you need more than 10 simultaneous CGI threads, edit the
+ # provided fcgiwrap-multiwatch.service file and increase the number of instances to whatever suits your needs.
+
+ systemctl is-active --quiet fcgiwrap.socket && systemctl stop fcgiwrap.socket
+ systemctl is-active --quiet fcgiwrap && systemctl stop fcgiwrap
+ systemctl is-active --quiet fcgiwrap-multiwatch && systemctl stop fcgiwrap-multiwatch
+ systemctl enable --now --quiet fcgiwrap-multiwatch && echo "* fcgiwrap-multiwatch successfully configured"
+ else
+ echo "ERROR: You must install Nginx, fcgiwrap, spawn-fcgi and multiwatch before using this script with the --nginx flag"
+ exit 1
+ fi
+ ;;
+
+ --apache )
+
+ systemctl daemon-reload
+
+ # Ensure Apache is installed
+ if [[ "$(pacman -Qs apache)" = *"local/apache"* ]]
+ then
+ # Ensure the main conf file is present
+ if [ -f /etc/httpd/conf/httpd.conf ]
+ then
+ # Enable mod_proxy
+ sed -i 's|#LoadModule proxy_module modules/mod_proxy.so|LoadModule proxy_module modules/mod_proxy.so|g' /etc/httpd/conf/httpd.conf
+ # Enable mod_proxy_fcgi
+ sed -i 's|#LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so|LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so|g' /etc/httpd/conf/httpd.conf
+ # Enable mod_rewrite
+ sed -i 's|#LoadModule rewrite_module modules/mod_rewrite.so|LoadModule rewrite_module modules/mod_rewrite.so|g' /etc/httpd/conf/httpd.conf
+ # Enable mod_cgid
+ sed -i 's|#LoadModule cgid_module modules/mod_cgid.so|LoadModule cgid_module modules/mod_cgid.so|g' /etc/httpd/conf/httpd.conf
+
+ # Enable ZoneMinder's VirtualHost if it's not already enabled
+ if ( ! grep -q 'zoneminder.conf' /etc/httpd/conf/httpd.conf )
+ then
+ echo "Include conf/extra/zoneminder.conf" >> /etc/httpd/conf/httpd.conf
+ fi
+
+ # Start Apache
+ systemctl is-active --quiet httpd && systemctl stop httpd
+ systemctl restart --quiet httpd && echo "* Apache successfully configured"
+ else
+ echo "ERROR: Apache is installed but /etc/httpd/conf/httpd.conf' was not found"
+ exit 1
+ fi
+ else
+ echo "ERROR: You must install Apache before using this script with the --apache flag"
+ exit 1
+ fi
+ ;;
+
+ * )
+
+ echo "Usage: $0 [--nginx|--apache]"
+ exit 1
+esac
+
+# Ensure MariaDB is installed
+if [[ "$(pacman -Qs mariadb)" = *"local/mariadb "* ]]
+then
+ # 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
+ mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql 2> /dev/null
+ fi
+
+ # Start MariaDB
+ systemctl restart --quiet mariadb
+
+ # Create ZoneMinder's database & user if they do not exist
+ if [ ! -d /var/lib/mysql/zm ]
+ then
+ # 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."
+ echo
+ mysql -uroot -p < /usr/share/zoneminder/db/zm_create.sql
+ echo
+ echo "* Enter the password one more time..."
+ echo
+ mysql -uroot -p -e "grant select,insert,update,delete,create,drop,alter,index,lock tables,alter routine,create routine,trigger,execute on zm.* to 'zmuser'@localhost identified by 'zmpass';"
+ echo
+ 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,drop,alter,index,lock tables,alter routine,create routine,trigger,execute on zm.* to 'zmuser'@localhost identified by 'zmpass';"
+ fi
+ fi
+ echo "* MariaDB successfully configured"
+else
+ echo "* Skipping MariaDB"
+fi
+
+systemctl restart php-fpm && echo "* php-fpm successfully configured"
+
+echo
+
+systemctl is-active --quiet zoneminder && systemctl stop zoneminder
+systemd-tmpfiles --create
+systemctl start zoneminder && echo " All done! ZoneMinder is (hopefully) listening at http://localhost:8095"
diff --git a/zoneminder-httpd.conf b/zoneminder-httpd.conf
index 45ec9d93ecc2..7ddfedc69e76 100644
--- a/zoneminder-httpd.conf
+++ b/zoneminder-httpd.conf
@@ -1,15 +1,15 @@
Listen 8095
<VirtualHost *:8095>
- DocumentRoot /srv/zoneminder/www
+ DocumentRoot /usr/share/webapps/zoneminder/www
# PHP handler
<FilesMatch \.php$>
SetHandler "proxy:unix:/run/php-fpm/php-fpm.sock|fcgi://localhost/"
</FilesMatch>
- ScriptAlias /cgi-bin /srv/zoneminder/cgi-bin
- <Directory /srv/zoneminder/cgi-bin>
+ ScriptAlias /cgi-bin /usr/share/webapps/zoneminder/cgi-bin
+ <Directory /usr/share/webapps/zoneminder/cgi-bin>
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
AllowOverride None
Require all granted
@@ -22,32 +22,32 @@ Listen 8095
Require all granted
</Directory>
- <Directory /srv/zoneminder/www>
+ <Directory /usr/share/webapps/zoneminder/www>
Options -Indexes +FollowSymLinks
AllowOverride None
Require all granted
DirectoryIndex index.php
</Directory>
- <Directory /srv/zoneminder/www/api>
+ <Directory /usr/share/webapps/zoneminder/www/api>
RewriteEngine On
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
RewriteBase /api
</Directory>
- <Directory /srv/zoneminder/www/api/app>
+ <Directory /usr/share/webapps/zoneminder/www/api/app>
RewriteEngine On
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
RewriteBase /api
</Directory>
- <Directory /srv/zoneminder/www/api/app/webroot>
+ <Directory /usr/share/webapps/zoneminder/www/api/app/webroot>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
RewriteBase /api
</Directory>
-</VirtualHost> \ No newline at end of file
+</VirtualHost>
diff --git a/zoneminder-nginx.conf b/zoneminder-nginx.conf
index 824146f66dc1..b1d394a33e3c 100644
--- a/zoneminder-nginx.conf
+++ b/zoneminder-nginx.conf
@@ -1,7 +1,7 @@
server {
listen 8095;
- root /srv/zoneminder/www;
+ root /usr/share/webapps/zoneminder/www;
index index.php;
diff --git a/zoneminder-php.ini b/zoneminder-php.ini
index 2aecc0e1a701..b43afea41987 100644
--- a/zoneminder-php.ini
+++ b/zoneminder-php.ini
@@ -6,5 +6,3 @@ extension=pdo_mysql
extension=sockets
extension=sysvsem
extension=zip
-
-date.timezone = PLACEHOLDER
diff --git a/zoneminder.install b/zoneminder.install
index e96d3c15a0b6..ab6f3c389821 100644
--- a/zoneminder.install
+++ b/zoneminder.install
@@ -1,225 +1,87 @@
post_install() {
echo
-
- systemctl daemon-reload
-
- ### Nginx & Apache ###
-
- # If Nginx is installed and either is active, or is inactive but Apache is not installed, we prefer Nginx.
- if [[ "$(pacman -Qs nginx)" = *"local/nginx"* ]] && { [ "$(systemctl is-active nginx)" = "active" ] || [[ "$(pacman -Qs apache)" != *"local/apache"* ]] ; }
- then
- # Ensure the main conf file is present
- if [ -f /etc/nginx/nginx.conf ]
- then
- # Configure Nginx with the folder structure used in Debian-based distributions
- 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
-
- # Create the sites-enabled folder if it's not already created
- if [ ! -d /etc/nginx/sites-enabled ]
- then
- mkdir -p /etc/nginx/sites-enabled
- fi
-
- # Enable ZoneMinder's server block if it's not already enabled
- if [ ! -f /etc/nginx/sites-enabled/zoneminder.conf ]
- then
- ln -sf /etc/nginx/sites-{available,enabled}/zoneminder.conf
- fi
-
- # (Re)start Nginx
- systemctl is-active --quiet nginx && systemctl stop nginx
- systemctl start nginx
- else
- echo "ERROR: Nginx was detected but file '/etc/nginx/nginx.conf' was not found. Something seems broken."
- echo
- fi
- # Else, if Nginx either is not installed, or is installed and inactive but Apache is also installed (no matter if it's active or not), we prefer Apache.
- elif [[ "$(pacman -Qs apache)" = *"local/apache"* ]]
- then
- # Ensure the main conf file is present
- if [ -f /etc/httpd/conf/httpd.conf ]
- then
- # Enable mod_proxy
- sed -i 's|#LoadModule proxy_module modules/mod_proxy.so|LoadModule proxy_module modules/mod_proxy.so|g' /etc/httpd/conf/httpd.conf
- # Enable mod_proxy_fcgi
- sed -i 's|#LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so|LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so|g' /etc/httpd/conf/httpd.conf
- # Enable mod_rewrite
- sed -i 's|#LoadModule rewrite_module modules/mod_rewrite.so|LoadModule rewrite_module modules/mod_rewrite.so|g' /etc/httpd/conf/httpd.conf
- # Enable mod_cgid
- sed -i 's|#LoadModule cgid_module modules/mod_cgid.so|LoadModule cgid_module modules/mod_cgid.so|g' /etc/httpd/conf/httpd.conf
-
- # Enable ZoneMinder's VirtualHost if it's not already enabled
- if ( ! grep -q 'zoneminder.conf' /etc/httpd/conf/httpd.conf )
- then
- echo "Include conf/extra/zoneminder.conf" >> /etc/httpd/conf/httpd.conf
- fi
-
- # (Re)start Apache
- systemctl is-active --quiet httpd && systemctl stop httpd
- systemctl start httpd
- else
- echo "ERROR: Apache was detected but file '/etc/httpd/conf/httpd.conf' was not found. Something seems broken."
- echo
- fi
- # Else, if neither of them is installed, we inform the user that something is seriously messed up.
- else
- echo "WARNING: Neither Nginx nor Apache were detected in your system. I hope you know what you're doing."
- echo
- fi
-
- ### fcgiwrap ###
-
- # By default fcgiwrap is configured to launch in 10 instances via spawn-fcgi and multiwatch. This should be
- # enough for ZoneMinder to operate with 3 cameras. If you need more than 10 simultaneous CGI threads, edit the
- # provided fcgiwrap-multiwatch.service file and increase the number of instances to whatever suits your needs.
-
- if [[ "$(pacman -Qs fcgiwrap)" = *"local/fcgiwrap"* ]]
- then
- systemctl is-active --quiet fcgiwrap.socket && systemctl stop fcgiwrap.socket
- systemctl is-active --quiet fcgiwrap && systemctl stop fcgiwrap
- systemctl is-active --quiet fcgiwrap-multiwatch && systemctl stop fcgiwrap-multiwatch
- systemctl start fcgiwrap-multiwatch
- fi
-
- ### PHP-FPM ###
-
- # To avoid modifying the global 'php.ini' file, this package uses a separate 'conf.d/zoneminder.ini' in order to apply
- # some PHP settings that ZoneMinder needs to function properly, namely to load some PHP modules and to set the correct
- # timezone.
- #
- # This has the side effect that any further changes to these specific PHP settings that have been overriden (i.e. to change
- # the timezone or to disable one of the modules) will either need to be made inside 'conf.d/zoneminder.ini', or that file
- # will have to be modified so it no longer overrides them.
- #
- # Modifying the global 'php.ini' on its own will have NO EFFECT as far as these settings are concerned.
-
- # 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
-
- if [[ "$(pacman -Qs php-fpm)" = *"local/php-fpm"* ]]
- then
- systemctl is-active --quiet php-fpm && systemctl stop php-fpm
- systemctl start php-fpm
- fi
-
- ### MariaDB ###
-
- # If MariaDB is installed
- if [[ "$(pacman -Qs mariadb)" = *"local/mariadb "* ]]
- then
- # Initialize MariaDB's default database if it's not already initialized
- if [ ! -d /var/lib/mysql/mysql ]
- then
- # Stop MariaDB if it's active
- systemctl is-active --quiet mariadb && systemctl stop mariadb
- mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql 2> /dev/null
- fi
-
- # Start MariaDB if it's not already active
- systemctl is-active --quiet mariadb || systemctl start mariadb
-
- # Create ZoneMinder's database & user if they do not exist
- if [ ! -d /var/lib/mysql/zm ]
- then
- # 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."
- echo
- mysql -uroot -p < /usr/share/zoneminder/db/zm_create.sql
- echo
- echo "* Enter the password one more time..."
- echo
- mysql -uroot -p -e "grant select,insert,update,delete,create,drop,alter,index,lock tables,alter routine,create routine,trigger,execute on zm.* to 'zmuser'@localhost identified by 'zmpass';"
- echo
- 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,drop,alter,index,lock tables,alter routine,create routine,trigger,execute on zm.* to 'zmuser'@localhost identified by 'zmpass';"
- fi
- fi
- fi
-
- ### ZoneMinder ###
-
- systemctl is-active --quiet zoneminder && systemctl stop zoneminder
- systemd-tmpfiles --create
- systemctl start --quiet zoneminder &&
- {
- echo "---------------"
+ echo " ZoneMinder has been installed but some additional steps are required:"
echo
-
- if [[ "$(systemctl is-active nginx)" = active ]] || [[ "$(systemctl is-active httpd)" = active ]]
- then
- echo "ZoneMinder is listening at http://localhost:8095"
- echo
- else
- echo "WARNING: ZoneMinder is running, but no web server has been configured."
- echo
- fi
+ echo "1) You will need to install a MySQL-compatible database server and create a database and user"
+ echo " for ZoneMinder. Then you will need to start the following systemd service:"
+ echo
+ echo " * mariadb.service"
+ echo
+ echo "2) You will need to install a web server and configure it to serve ZoneMinder's web interface,"
+ echo " located at /usr/share/webapps/zoneminder/. Premade configurations are provided for Apache and"
+ echo " Nginx; you can find them at /etc/httpd/conf/extra for Apache and /etc/nginx/sites-available for"
+ echo " Nginx. After you install the web server, you will need to start the following systemd services:"
+ echo
+ echo " * nginx.service (for Nginx)"
+ echo " * httpd.service (for Apache)"
+ echo
+ echo " ZoneMinder's default network address is http://localhost:8095"
+ echo
+ echo "3) If you choose to use Nginx, you will also need to install fcgiwrap, spawn-fcgi and multiwatch"
+ echo " and then start the following systemd service (also provided by this package):"
+ echo
+ echo " * fcgiwrap-multiwatch.service"
+ echo
+ echo "4) After the previous steps are complete, you will also need to refresh systemd's tmpfiles and then"
+ echo " start the following systemd services:"
+ echo
+ echo " * php-fpm.service"
+ echo " * zoneminder.service"
+ echo
+ echo
+ echo " For more detailed info on how to configure ZoneMinder, you should check the following links:"
+ echo
+ echo " * https://wiki.archlinux.org/index.php/ZoneMinder"
+ echo " * https://zoneminder.readthedocs.io/en/latest/"
+ echo
+ echo " You can also run '/usr/bin/zmsetup.sh' if you wish to automate part or all of the configuration process."
+ echo
+ echo " Bug reports and packaging suggestions are always welcome at https://aur.archlinux.org/packages/zoneminder/"
echo
- }
}
post_upgrade() {
+ echo
+ systemctl daemon-reload
+
# Parse zm.conf and all custom configuration files
. /etc/zoneminder/zm.conf
- for CONF in /etc/zoneminder/conf.d/*.conf; do
+ for CONF in /etc/zoneminder/conf.d/*.conf
+ do
. $CONF
done
# Check if we're running a local database server
- if [ "$ZM_DB_HOST" = "localhost" ] || [[ "$ZM_DB_HOST" = "127.0.0.1"* ]]; then
- systemctl daemon-reload
-
- # Make sure MariaDB is running before we attempt to use the updater
- systemctl is-active --quiet mariadb || systemctl start mariadb
-
- # Make sure ZoneMinder is *not* running before we attempt to use the updater
- systemctl is-active --quiet zoneminder && systemctl stop zoneminder
-
- echo
- echo "---------------"
-
- # Temporary solution to apply new privileges on preexisting user & database
- # Check for database root password
- if [[ "$(mysql -uroot -e "select * from mysql.user;" 2>&1)" = *"Access denied"* ]]
+ if [[ "$ZM_DB_HOST" = "localhost" ]] || [[ "$ZM_DB_HOST" = "127.0.0.1"* ]]
+ then
+ # Check if our database is MariaDB
+ if [[ "$(pacman -Qs mariadb)" = *"local/mariadb "* ]]
then
- # If a database root password is set
- echo
- echo "* Secure MariaDB installation found, please enter the database root password."
- echo
- mysql -uroot -p -e "grant select,insert,update,delete,create,drop,alter,index,lock tables,alter routine,create routine,trigger,execute on zm.* to 'zmuser'@localhost identified by 'zmpass';"
+ # Make sure MariaDB is running before we attempt to use the updater
+ systemctl is-active --quiet mariadb || systemctl start mariadb
+
+ # Make sure ZoneMinder is *NOT* running before we attempt to use the updater
+ systemctl is-active --quiet zoneminder && systemctl stop zoneminder
+
+ # Run the updater
+ /usr/bin/zmupdate.pl --nointeractive
+ /usr/bin/zmupdate.pl --nointeractive --freshen > /dev/null 2>&1
+
+ # Update PTZ control presets
+ /usr/bin/zmcamtool.pl --import > /dev/null 2>&1
+
+ # Start ZoneMinder
+ systemctl start zoneminder || echo "ERROR: zoneminder.service could not be started, something is wrong"
else
- # If a database root password is not set
- mysql -uroot -e "grant select,insert,update,delete,create,drop,alter,index,lock tables,alter routine,create routine,trigger,execute on zm.* to 'zmuser'@localhost identified by 'zmpass';"
+ echo "ERROR: MariaDB was not found, please update ZoneMinder's database manually"
+ echo
fi
-
- # Run the updater
- /usr/bin/zmupdate.pl --nointeractive
- /usr/bin/zmupdate.pl --nointeractive --freshen > /dev/null 2>&1
-
- # Update PTZ control presets
- /usr/bin/zmcamtool.pl --import > /dev/null 2>&1
-
- systemctl start zoneminder
- else
- echo
- echo "---------------"
- echo
- echo "Multiserver setup detected, database update skipped."
fi
-
- post_install
}
post_remove() {
systemctl daemon-reload && systemctl is-active --quiet zoneminder && systemctl stop zoneminder
-
+
# Disable ZoneMinder's Apache VirtualHost
if [ -f /etc/httpd/conf/httpd.conf ]
then