diff options
-rw-r--r-- | .SRCINFO | 16 | ||||
-rw-r--r-- | PKGBUILD | 38 | ||||
-rw-r--r-- | zoneminder-nginx.conf | 2 | ||||
-rw-r--r-- | zoneminder-tmpfile.conf | 2 | ||||
-rw-r--r-- | zoneminder.install | 125 |
5 files changed, 104 insertions, 79 deletions
@@ -1,11 +1,11 @@ pkgbase = zoneminder - pkgdesc = A full-featured, open source, state-of-the-art video surveillance software system. - pkgver = 1.32.1 - pkgrel = 3 + pkgdesc = A full-featured, open source, state-of-the-art video surveillance software system + pkgver = 1.32.2 + pkgrel = 1 url = https://zoneminder.com/ install = zoneminder.install arch = x86_64 - license = GPLv2 + license = GPL2 makedepends = cmake depends = polkit depends = ffmpeg @@ -47,7 +47,7 @@ pkgbase = zoneminder conflicts = zoneminder-git backup = etc/nginx/sites-available/zoneminder.conf backup = etc/httpd/conf/extra/zoneminder.conf - source = https://github.com/ZoneMinder/ZoneMinder/archive/1.32.1.tar.gz + source = https://github.com/ZoneMinder/ZoneMinder/archive/1.32.2.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 = zoneminder-nginx.conf @@ -55,14 +55,14 @@ pkgbase = zoneminder source = zoneminder-php.ini source = zoneminder.service source = zoneminder-tmpfile.conf - sha256sums = a10c0c416e2127111b4d72f0046ed3a1f56708e3f4b48680848d755b01811d3c + sha256sums = cf72cbd45d91ef0232c123dac5f908993f8941a62b9ae96975c4e6043bd4b9a9 sha256sums = 55be29e1eccb44d4ad0db8b23c37cec50f5341f8e498583d472ed1f0493876e3 sha256sums = dbd231e97b950c698f0f501d6a53c7291c9985e766b09e3afe00cfe69a969f44 - sha256sums = 7b14652fa05ed07043abb082ab699b36ea76c5bfc0fb6fbc4418cbd66e4e3181 + sha256sums = b9d5694e12db2d79701769cb93a178e99d1a4c52c1c98ecdc7edaf8ede4b6820 sha256sums = 1944e27db3b17edac152209b2b35e914ed9700a2ffe0255b012661197a328178 sha256sums = 7905ceddbb049de0f9bf4f1eb58779dfe310a65c4d2ec44854d592d4f31b6a72 sha256sums = 3e4de227e3154dffa887f2286c339ab3cf456f6d74a400b2786192b7e2b129c0 - sha256sums = d1341338538f2ac771e6b1eee9aa48e8b0da4a140024c74bc33a9f6b52443bdd + sha256sums = b69ac1deaaf3cf84b4ae4dbab794e1b062823de817f1e3a816ccf5438db440c0 pkgname = zoneminder @@ -23,8 +23,6 @@ # 2) By default, ZoneMinder now runs at localhost:8095 instead of localhost/zm (this can be changed by editing the provided conf files). # # 3) Apache was switched out in favor of Nginx, but remains as an optional dependency. -# -# 4) Nginx and MariaDB are hard-coded as dependencies, but can be easily removed in order to achieve a web server agnostic and/or database-less PKGBUILD. ####################################################################################################################### @@ -39,12 +37,12 @@ pkgname=zoneminder -pkgver=1.32.1 -pkgrel=3 -pkgdesc='A full-featured, open source, state-of-the-art video surveillance software system.' +pkgver=1.32.2 +pkgrel=1 +pkgdesc='A full-featured, open source, state-of-the-art video surveillance software system' arch=('x86_64') url='https://zoneminder.com/' -license=('GPLv2') +license=('GPL2') depends=('polkit' 'ffmpeg' 'libmp4v2' # Remove the following line if you want to install ZoneMinder without a local database server, e.g. as part of a Multi-Server setup 'mariadb' @@ -77,11 +75,11 @@ source=("https://github.com/ZoneMinder/ZoneMinder/archive/$pkgver.tar.gz" "zoneminder-php.ini" "zoneminder.service" "zoneminder-tmpfile.conf") -sha256sums=('a10c0c416e2127111b4d72f0046ed3a1f56708e3f4b48680848d755b01811d3c' +sha256sums=('cf72cbd45d91ef0232c123dac5f908993f8941a62b9ae96975c4e6043bd4b9a9' '55be29e1eccb44d4ad0db8b23c37cec50f5341f8e498583d472ed1f0493876e3' 'dbd231e97b950c698f0f501d6a53c7291c9985e766b09e3afe00cfe69a969f44' # zoneminder-nginx.conf - '7b14652fa05ed07043abb082ab699b36ea76c5bfc0fb6fbc4418cbd66e4e3181' + 'b9d5694e12db2d79701769cb93a178e99d1a4c52c1c98ecdc7edaf8ede4b6820' # zoneminder-httpd.conf '1944e27db3b17edac152209b2b35e914ed9700a2ffe0255b012661197a328178' # zoneminder-php.ini @@ -89,7 +87,7 @@ sha256sums=('a10c0c416e2127111b4d72f0046ed3a1f56708e3f4b48680848d755b01811d3c' # zoneminder.service '3e4de227e3154dffa887f2286c339ab3cf456f6d74a400b2786192b7e2b129c0' # zoneminder-tmpfile.conf - 'd1341338538f2ac771e6b1eee9aa48e8b0da4a140024c74bc33a9f6b52443bdd') + 'b69ac1deaaf3cf84b4ae4dbab794e1b062823de817f1e3a816ccf5438db440c0') prepare () { cd $pkgname-$pkgver @@ -100,6 +98,9 @@ prepare () { # Fix the launcher sed -i 's|localhost/zm|localhost:8095|g' misc/$pkgname.desktop.in + + # Temporary fix for Montage Review + sed -i 's|/zm/index.php|/index.php|g' web/skins/classic/views/js/montagereview.js } build() { @@ -111,9 +112,9 @@ build() { -DZM_RUNDIR=/run/$pkgname \ -DZM_SOCKDIR=/run/$pkgname \ -DZM_LOGDIR=/var/log/$pkgname \ + -DZM_TMPDIR=/var/tmp/$pkgname \ -DZM_CONTENTDIR=/var/lib/$pkgname \ -DZM_CACHEDIR=/var/lib/$pkgname/cache \ - -DZM_TMPDIR=/var/lib/$pkgname/temp \ -DZM_WEBDIR=/srv/$pkgname/www \ -DZM_CGIDIR=/srv/$pkgname/cgi-bin \ -DZM_WEB_USER=http . @@ -134,15 +135,15 @@ package() { install -dm775 -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,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 + 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 -s /srv/$pkgname/cgi-bin $pkgdir/srv/$pkgname/www - ln -s /var/lib/$pkgname/cache $pkgdir/srv/$pkgname/www - chown -Rh http:http $pkgdir/srv/$pkgname + 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 + + # Link ZM_WEBDIR/api/app/tmp to ZM_TMPDIR + ln -sf /var/tmp/$pkgname $pkgdir/srv/$pkgname/www/api/app/tmp # Set correct permissions for ZM_CONFIG_DIR & ZM_CONFIG_SUBDIR chmod -R 755 $pkgdir/etc/$pkgname @@ -167,7 +168,6 @@ package() { # Install logrotate conf file install -Dm644 misc/logrotate.conf $pkgdir/etc/logrotate.d/$pkgname - # Copy license and database schemas - install -Dm644 COPYING $pkgdir/usr/share/licenses/$pkgname/LICENSE + # Copy default database schemas install -Dm644 db/zm*.sql $pkgdir/usr/share/$pkgname/db } diff --git a/zoneminder-nginx.conf b/zoneminder-nginx.conf index 29fc1dde40b7..2d2782fa3fa0 100644 --- a/zoneminder-nginx.conf +++ b/zoneminder-nginx.conf @@ -12,7 +12,7 @@ server { location / { try_files $uri $uri/ /index.php?$args =404; - location ~ /api/(css|img) { + location ~ /api/(css|img|ico) { rewrite ^/api(.+)$ /api/app/webroot/$1 break; try_files $uri $uri/ =404; } diff --git a/zoneminder-tmpfile.conf b/zoneminder-tmpfile.conf index 441e04927b7c..c2e27aa1e62c 100644 --- a/zoneminder-tmpfile.conf +++ b/zoneminder-tmpfile.conf @@ -1,2 +1,2 @@ D /run/zoneminder 0775 http http -D /var/lib/zoneminder/temp 0775 http http +D /var/tmp/zoneminder 0775 http http diff --git a/zoneminder.install b/zoneminder.install index 0c7a838ca247..a1c83c9eaefa 100644 --- a/zoneminder.install +++ b/zoneminder.install @@ -3,73 +3,78 @@ post_install() { systemctl daemon-reload - ### Apache ### - if [ -f /usr/lib/systemd/system/httpd.service ] - then - # Check if 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 ( ! grep -q 'zoneminder.conf' /etc/httpd/conf/httpd.conf ) - then - echo "Include conf/extra/zoneminder.conf" >> /etc/httpd/conf/httpd.conf - fi - fi - - # Check if Nginx is running and if not (re)start Apache - if [ "$(systemctl is-active nginx)" != "active" ] - then - systemctl is-active --quiet httpd && systemctl stop httpd - systemctl start httpd - fi - fi + ### Nginx & Apache ### - ### Nginx ### - if [ -f /usr/lib/systemd/system/nginx.service ] + # 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 - # Check if the main conf file is present - if [ -f /etc/nginx/nginx.conf ] + # Ensure the main conf file is present + if [ -f /etc/nginx/nginx.conf ] then - # Configure it with the folder structure used in Debian-based distributions + # 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 - # Enable ZoneMinder's server block + # 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 -s /etc/nginx/sites-{available,enabled}/zoneminder.conf + ln -sf /etc/nginx/sites-{available,enabled}/zoneminder.conf fi - fi - - # Check if Apache is running and if not (re)start Nginx - if [ "$(systemctl is-active httpd)" != "active" ] - then + + # (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, 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 "ERROR: Neither Nginx nor Apache were detected in your system. I hope you know what you're doing." + echo fi ### fcgiwrap ### - if [ -f /usr/lib/systemd/system/fcgiwrap.service ] + 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 @@ -78,10 +83,11 @@ post_install() { ### 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 - if [ -f /usr/lib/systemd/system/php-fpm.service ] + if [[ "$(pacman -Qs php-fpm)" = *"local/php-fpm"* ]] then systemctl is-active --quiet php-fpm && systemctl stop php-fpm systemctl start php-fpm @@ -90,16 +96,19 @@ post_install() { ### MariaDB ### - if [ -f /usr/lib/systemd/system/mariadb.service ] + # 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 # 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 + # 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 @@ -109,11 +118,11 @@ post_install() { 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 \* Secure MariaDB installation found, please enter the database root password. echo mysql -uroot -p < /usr/share/zoneminder/db/zm_create.sql echo - echo \* One more time... + echo \* Enter the password one more time... echo mysql -uroot -p -e "grant select,insert,update,delete,create,alter,index,lock tables on zm.* to 'zmuser'@localhost identified by 'zmpass';" echo @@ -135,7 +144,14 @@ post_install() { echo --------------- echo - echo ZoneMinder is listening at http://localhost:8095 + + if [[ "$(systemctl is-active nginx)" = active ]] || [[ "$(systemctl is-active httpd)" = active ]] + then + echo ZoneMinder is listening at http://localhost:8095 + else + echo WARNING: No web server has been configured. + fi + echo } @@ -144,11 +160,20 @@ post_upgrade() { echo --------------- echo - echo The ZoneMinder updater will now run. - # Make sure ZoneMinder is *not* running before we attempt to use its updater + echo The ZoneMinder updater will now run. + + # Make sure ZoneMinder is *not* running before we attempt to use the updater systemctl is-active --quiet zoneminder && systemctl stop zoneminder - /usr/bin/zmupdate.pl -f + + # Make sure MariaDB *is* running before we attempt to use the updater + # NOTE: We probably don't want this in a Multi Server setup because MariaDB will not be running locally, + # but since it will simply generate a harmless error and the updater will still run, for now I'm leaving it as is + systemctl is-active --quiet mariadb || systemctl start mariadb + + # Run the updater + /usr/bin/zmupdate.pl + systemctl start zoneminder echo |