diff --git a/distros/debian8/control b/distros/debian8/control index cef6899c38..613abe30b4 100644 --- a/distros/debian8/control +++ b/distros/debian8/control @@ -2,15 +2,15 @@ Source: zoneminder Section: net Priority: optional Maintainer: Isaac Connor -Build-Depends: debhelper (>= 9), dh-systemd (>= 1.5), autoconf, automake, quilt, libphp-serialization-perl, libgnutls28-dev, libmysqlclient-dev | libmariadbclient-dev, libdbd-mysql-perl, libdate-manip-perl, libwww-perl, libjpeg8-dev|libjpeg9-dev|libjpeg62-turbo-dev, libpcre3-dev, libavcodec-dev, libavformat-dev (>= 3:0.svn20090204), libswscale-dev (>= 3:0.svn20090204), libavutil-dev, libv4l-dev (>= 0.8.3), libbz2-dev, libtool, libsys-mmap-perl, ffmpeg | libav-tools, libnetpbm10-dev, libavdevice-dev, libdevice-serialport-perl, libarchive-zip-perl, libmime-lite-perl, dh-autoreconf, libvlccore-dev, libvlc-dev, libcurl4-gnutls-dev | libcurl4-nss-dev | libcurl4-openssl-dev, libgcrypt11-dev|libgcrypt20-dev, libpolkit-gobject-1-dev +Build-Depends: debhelper (>= 9), po-debconf (>= 1.0), dh-systemd (>= 1.5), autoconf, automake, quilt, libphp-serialization-perl, libgnutls28-dev, libmysqlclient-dev | libmariadbclient-dev, libdbd-mysql-perl, libdate-manip-perl, libwww-perl, libjpeg8-dev|libjpeg9-dev|libjpeg62-turbo-dev, libpcre3-dev, libavcodec-dev, libavformat-dev (>= 3:0.svn20090204), libswscale-dev (>= 3:0.svn20090204), libavutil-dev, libv4l-dev (>= 0.8.3), libbz2-dev, libtool, libsys-mmap-perl, ffmpeg | libav-tools, libnetpbm10-dev, libavdevice-dev, libdevice-serialport-perl, libarchive-zip-perl, libmime-lite-perl, dh-autoreconf, libvlccore-dev, libvlc-dev, libcurl4-gnutls-dev | libcurl4-nss-dev | libcurl4-openssl-dev, libgcrypt11-dev|libgcrypt20-dev, libpolkit-gobject-1-dev Standards-Version: 3.9.6 Package: zoneminder Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends}, apache2, libapache2-mod-php5 | libapache2-mod-fcgid, php5, php5-mysql|php5-mysqlnd, libphp-serialization-perl, libdate-manip-perl, libmime-lite-perl, libmime-tools-perl, mariadb-client|mysql-client, libwww-perl, libarchive-tar-perl, libarchive-zip-perl, libdevice-serialport-perl, libpcre3, ffmpeg | libav-tools, rsyslog | system-log-daemon, libmodule-load-perl, libsys-mmap-perl, libjson-any-perl, netpbm, libavdevice55, libjpeg8|libjpeg9|libjpeg62-turbo, zip, libnet-sftp-foreign-perl, libio-pty-perl, libexpect-perl, libvlccore8, libvlc5, libcurl4-gnutls-dev | libcurl4-nss-dev | libcurl4-openssl-dev, liburi-encode-perl, libgcrypt11|libgcrypt20, libpolkit-gobject-1-0, policykit-1 +Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends}, debconf, dbconfig-common, apache2, libapache2-mod-php5 | libapache2-mod-fcgid, php5, php5-mysql|php5-mysqlnd, libphp-serialization-perl, libdate-manip-perl, libmime-lite-perl, libmime-tools-perl, mariadb-client|mysql-client, libwww-perl, libarchive-tar-perl, libarchive-zip-perl, libdevice-serialport-perl, libpcre3, ffmpeg | libav-tools, rsyslog | system-log-daemon, libmodule-load-perl, libsys-mmap-perl, libjson-any-perl, netpbm, libavdevice55, libjpeg8|libjpeg9|libjpeg62-turbo, zip, libnet-sftp-foreign-perl, libio-pty-perl, libexpect-perl, libvlccore8, libvlc5, libcurl4-gnutls-dev | libcurl4-nss-dev | libcurl4-openssl-dev, liburi-encode-perl, libgcrypt11|libgcrypt20, libpolkit-gobject-1-0, policykit-1 Recommends: mysql-server|mariadb-server Description: Video camera security and surveillance solution - ZoneMinder is intended for use in single or multi-camera video security + ZoneMinder is intended for use in single or multi-camera video security applications, including commercial or home CCTV, theft prevention and child or family member or home monitoring and other care scenarios. It supports capture, analysis, recording, and monitoring of video data coming @@ -28,7 +28,7 @@ Architecture: any Depends: zoneminder (= ${binary:Version}), ${misc:Depends} Description: Debugging symbols for zoneminder. ZoneMinder is a video camera security and surveillance solution. - ZoneMinder is intended for use in single or multi-camera video security + ZoneMinder is intended for use in single or multi-camera video security applications, including commercial or home CCTV, theft prevention and child or family member or home monitoring and other care scenarios. It supports capture, analysis, recording, and monitoring of video data coming diff --git a/distros/debian8/po/POTFILES.in b/distros/debian8/po/POTFILES.in new file mode 100644 index 0000000000..a3d64930e9 --- /dev/null +++ b/distros/debian8/po/POTFILES.in @@ -0,0 +1 @@ +[type: gettext/rfc822deb] zoneminder.templates diff --git a/distros/debian8/po/fr.po b/distros/debian8/po/fr.po new file mode 100644 index 0000000000..8b512df1b2 --- /dev/null +++ b/distros/debian8/po/fr.po @@ -0,0 +1,252 @@ +# debconf french translation file for ZoneMinder. +# Copyright (C) 2001-2008 Philip Coombes +# This file is distributed under the same license as the zoneminder package. +# First author: Emmanuel Papin , 2014. +# +msgid "" +msgstr "" +"Project-Id-Version: zoneminder\n" +"Report-Msgid-Bugs-To: zoneminder@packages.debian.org\n" +"POT-Creation-Date: 2014-12-12 12:28+0100\n" +"PO-Revision-Date: 2014-12-07 00:40+0100\n" +"Last-Translator: Emmanuel Papin \n" +"Language-Team: French \n" +"Language: fr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Type: select +#. Choices +#: ../zoneminder.templates:1001 +msgid "local" +msgstr "local" + +#. Type: select +#. Choices +#: ../zoneminder.templates:1001 +msgid "remote" +msgstr "distant" + +#. Type: select +#. Description +#: ../zoneminder.templates:1002 +msgid "Database location:" +msgstr "Emplacement de la base de donnée :" + +#. Type: select +#. Description +#: ../zoneminder.templates:1002 +msgid "" +"A database server is required to run ZoneMinder. The database can be " +"installed either locally or remotely on a machine of your network." +msgstr "" +"Un serveur de base de données est requis pour ZoneMinder. La base de donnée " +"peut être installée localement ou à distance sur une machine de votre réseau." + +#. Type: select +#. Description +#: ../zoneminder.templates:1002 +msgid "" +"If you choose a remote location, you will have to select the 'tcp/ip' " +"connection method and enter the hostname or ip address of the remote machine " +"in the next configuration screens." +msgstr "" +"Si vous choisissez un emplacement distant, vous devrez sélectionner la " +"méthode de connexion 'tcp/ip' et entrer le nom réseau ou l'adresse ip de la " +"machine distante dans les écrans de configuration suivants." + +#. Type: error +#. Description +#: ../zoneminder.templates:2001 +msgid "No local database server is available:" +msgstr "Aucun serveur local de base de données n'est disponible :" + +#. Type: error +#. Description +#: ../zoneminder.templates:2001 +msgid "" +"Currently ZoneMinder supports mysql or mariadb database server but none of " +"them appears to be installed on this machine." +msgstr "" +"Actuellement ZoneMinder supporte les serveurs de base de données mysql et " +"mariadb mais aucun d'entre eux n'est installé sur cette machine." + +#. Type: error +#. Description +#: ../zoneminder.templates:2001 +msgid "" +"In order to complete ZoneMinder's installation, after ending of this " +"assistant, please install a compatible database server and then restart the " +"assistant by invoking:" +msgstr "" +"Afin de compléter l'installation de ZoneMinder, après la fermeture de cet " +"assitant, veuillez installer un serveur de base de données compatible et " +"ensuite redémarrez l'assistant en invoquant :" + +#. Type: error +#. Description +#. Type: error +#. Description +#: ../zoneminder.templates:2001 ../zoneminder.templates:3001 +msgid "$ sudo dpkg-reconfigure zoneminder" +msgstr "$ sudo dpkg-reconfigure zoneminder" + +#. Type: error +#. Description +#: ../zoneminder.templates:3001 +msgid "Remote database servers are not allowed:" +msgstr "Les serveurs de base de données distants ne sont pas autorisés :" + +#. Type: error +#. Description +#: ../zoneminder.templates:3001 +msgid "" +"The current configuration of dbconfig-common does not allow installation of " +"a database on remote servers." +msgstr "" +"La configuration actuelle de dbconfig-common ne permet pas l'installation de " +"bases de données sur des serveurs distants." + +#. Type: error +#. Description +#: ../zoneminder.templates:3001 +msgid "" +"In order to reconfigure dbconfig-common, please invoke the following command " +"after ending of this assistant:" +msgstr "" +"Afin de reconfigurer dbconfig-common, veuillez invoquer la commande suivante " +"après la fermeture de cet assitant :" + +#. Type: error +#. Description +#: ../zoneminder.templates:3001 +msgid "$ sudo dpkg-reconfigure dbconfig-common" +msgstr "$ sudo dpkg-reconfigure dbconfig-common" + +#. Type: error +#. Description +#: ../zoneminder.templates:3001 +msgid "" +"Then, to complete ZoneMinder's installation, please restart this assistant " +"by invoking:" +msgstr "" +"Ensuite, pour compléter l'installation de ZoneMinder, veuillez redémarrer " +"cet assistant en invoquant :" + +#. Type: multiselect +#. Description +#: ../zoneminder.templates:4001 +msgid "Web server to reconfigure automatically:" +msgstr "Serveur web à reconfigurer automatiquement :" + +#. Type: multiselect +#. Description +#: ../zoneminder.templates:4001 +msgid "" +"Please choose the web server that should be automatically configured for " +"ZoneMinder's web portal access." +msgstr "" +"Veuillez choisir le serveur web à reconfigurer automatiquement pour l'accès " +"au portail web de ZoneMinder." + +#. Type: password +#. Description +#: ../zoneminder.templates:5001 +msgid "New password for the ZoneMinder 'admin' user:" +msgstr "Nouveau mot de passe pour le compte 'admin' de ZoneMinder :" + +#. Type: password +#. Description +#: ../zoneminder.templates:5001 +msgid "Please enter the password of the default administrative user." +msgstr "Veuillez entrer le mot de passe du compte administrateur par défaut." + +#. Type: password +#. Description +#: ../zoneminder.templates:5001 +msgid "" +"While not mandatory, it is highly recommended that you set a custom password " +"for the administrative 'admin' user." +msgstr "" +"Bien que cela ne soit pas obligatoire, il est fortement recommandé de " +"fournir un mot de passe personnalisé pour le compte administrateur 'admin'." + +#. Type: password +#. Description +#: ../zoneminder.templates:5001 +msgid "If this field is left blank, the password will not be changed." +msgstr "Si le champ est laissé vide, le mot de passe ne sera pas changé." + +#. Type: password +#. Description +#: ../zoneminder.templates:6001 +msgid "Repeat password for the ZoneMinder 'admin' user:" +msgstr "Répéter le mot de passe pour le compte 'admin' de ZoneMinder :" + +#. Type: error +#. Description +#: ../zoneminder.templates:7001 +msgid "Password input error" +msgstr "Erreur de mot de passe" + +#. Type: error +#. Description +#: ../zoneminder.templates:7001 +msgid "The two passwords you entered were not the same. Please try again." +msgstr "" +"Les deux mots de passe saisis ne sont pas les mêmes. Veuillez essayer à " +"nouveau." + +#. Type: boolean +#. Description +#: ../zoneminder.templates:8001 +msgid "Delete this non empty directory?" +msgstr "Supprimer ce répertoire non vide ?" + +#. Type: boolean +#. Description +#: ../zoneminder.templates:8001 +msgid "" +"A purge of the ZoneMinder package is performed but the directory '/var/cache/" +"zoneminder' is not empty so it will not be deleted." +msgstr "" +"Une purge du paquet ZoneMinder est en cours mais le répertoire '/var/cache/" +"zoneminder' n'est pas vide et sera donc conservé." + +#. Type: boolean +#. Description +#: ../zoneminder.templates:8001 +msgid "" +"Please consider that this directory is designed to contain data resulting " +"from event detection. Therefore, \"proof of evidence\" could be lost!\"" +msgstr "" +"Veuillez considérer que ce répertoire est conçu pour contenir des données " +"résultants de la détection d'événements. Par conséquent, des preuves " +"pourraient être perdues !" + +#. Type: boolean +#. Description +#: ../zoneminder.templates:8001 +msgid "" +"If you are not sure of your decision, please do not delete this directory " +"but perform a manual checkup." +msgstr "" +"Si vous n'êtes pas sûr de votre décision, veuillez conserver ce répertoire " +"et effectuer une vérification manuelle." + +#. Type: boolean +#. Description +#: ../zoneminder.templates:9001 +msgid "Deletion confirmed?" +msgstr "Supression confirmée ?" + +#. Type: boolean +#. Description +#: ../zoneminder.templates:9001 +msgid "" +"You have allowed the deletion of directory '/var/cache/zoneminder' although " +"it may contain critical data." +msgstr "" +"Vous avez autorisé la suppression du répertoire '/var/cache/zoneminder' bien " +"qu'il puisse contenir des données critiques." diff --git a/distros/debian8/po/templates.pot b/distros/debian8/po/templates.pot new file mode 100644 index 0000000000..7d10caa4b6 --- /dev/null +++ b/distros/debian8/po/templates.pot @@ -0,0 +1,222 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: zoneminder\n" +"Report-Msgid-Bugs-To: zoneminder@packages.debian.org\n" +"POT-Creation-Date: 2014-12-12 12:28+0100\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Type: select +#. Choices +#: ../zoneminder.templates:1001 +msgid "local" +msgstr "" + +#. Type: select +#. Choices +#: ../zoneminder.templates:1001 +msgid "remote" +msgstr "" + +#. Type: select +#. Description +#: ../zoneminder.templates:1002 +msgid "Database location:" +msgstr "" + +#. Type: select +#. Description +#: ../zoneminder.templates:1002 +msgid "" +"A database server is required to run ZoneMinder. The database can be " +"installed either locally or remotely on a machine of your network." +msgstr "" + +#. Type: select +#. Description +#: ../zoneminder.templates:1002 +msgid "" +"If you choose a remote location, you will have to select the 'tcp/ip' " +"connection method and enter the hostname or ip address of the remote machine " +"in the next configuration screens." +msgstr "" + +#. Type: error +#. Description +#: ../zoneminder.templates:2001 +msgid "No local database server is available:" +msgstr "" + +#. Type: error +#. Description +#: ../zoneminder.templates:2001 +msgid "" +"Currently ZoneMinder supports mysql or mariadb database server but none of " +"them appears to be installed on this machine." +msgstr "" + +#. Type: error +#. Description +#: ../zoneminder.templates:2001 +msgid "" +"In order to complete ZoneMinder's installation, after ending of this " +"assistant, please install a compatible database server and then restart the " +"assistant by invoking:" +msgstr "" + +#. Type: error +#. Description +#. Type: error +#. Description +#: ../zoneminder.templates:2001 ../zoneminder.templates:3001 +msgid "$ sudo dpkg-reconfigure zoneminder" +msgstr "" + +#. Type: error +#. Description +#: ../zoneminder.templates:3001 +msgid "Remote database servers are not allowed:" +msgstr "" + +#. Type: error +#. Description +#: ../zoneminder.templates:3001 +msgid "" +"The current configuration of dbconfig-common does not allow installation of " +"a database on remote servers." +msgstr "" + +#. Type: error +#. Description +#: ../zoneminder.templates:3001 +msgid "" +"In order to reconfigure dbconfig-common, please invoke the following command " +"after ending of this assistant:" +msgstr "" + +#. Type: error +#. Description +#: ../zoneminder.templates:3001 +msgid "$ sudo dpkg-reconfigure dbconfig-common" +msgstr "" + +#. Type: error +#. Description +#: ../zoneminder.templates:3001 +msgid "" +"Then, to complete ZoneMinder's installation, please restart this assistant " +"by invoking:" +msgstr "" + +#. Type: multiselect +#. Description +#: ../zoneminder.templates:4001 +msgid "Web server to reconfigure automatically:" +msgstr "" + +#. Type: multiselect +#. Description +#: ../zoneminder.templates:4001 +msgid "" +"Please choose the web server that should be automatically configured for " +"ZoneMinder's web portal access." +msgstr "" + +#. Type: password +#. Description +#: ../zoneminder.templates:5001 +msgid "New password for the ZoneMinder 'admin' user:" +msgstr "" + +#. Type: password +#. Description +#: ../zoneminder.templates:5001 +msgid "Please enter the password of the default administrative user." +msgstr "" + +#. Type: password +#. Description +#: ../zoneminder.templates:5001 +msgid "" +"While not mandatory, it is highly recommended that you set a custom password " +"for the administrative 'admin' user." +msgstr "" + +#. Type: password +#. Description +#: ../zoneminder.templates:5001 +msgid "If this field is left blank, the password will not be changed." +msgstr "" + +#. Type: password +#. Description +#: ../zoneminder.templates:6001 +msgid "Repeat password for the ZoneMinder 'admin' user:" +msgstr "" + +#. Type: error +#. Description +#: ../zoneminder.templates:7001 +msgid "Password input error" +msgstr "" + +#. Type: error +#. Description +#: ../zoneminder.templates:7001 +msgid "The two passwords you entered were not the same. Please try again." +msgstr "" + +#. Type: boolean +#. Description +#: ../zoneminder.templates:8001 +msgid "Delete this non empty directory?" +msgstr "" + +#. Type: boolean +#. Description +#: ../zoneminder.templates:8001 +msgid "" +"A purge of the ZoneMinder package is performed but the directory '/var/cache/" +"zoneminder' is not empty so it will not be deleted." +msgstr "" + +#. Type: boolean +#. Description +#: ../zoneminder.templates:8001 +msgid "" +"Please consider that this directory is designed to contain data resulting " +"from event detection. Therefore, \"proof of evidence\" could be lost!\"" +msgstr "" + +#. Type: boolean +#. Description +#: ../zoneminder.templates:8001 +msgid "" +"If you are not sure of your decision, please do not delete this directory " +"but perform a manual checkup." +msgstr "" + +#. Type: boolean +#. Description +#: ../zoneminder.templates:9001 +msgid "Deletion confirmed?" +msgstr "" + +#. Type: boolean +#. Description +#: ../zoneminder.templates:9001 +msgid "" +"You have allowed the deletion of directory '/var/cache/zoneminder' although " +"it may contain critical data." +msgstr "" diff --git a/distros/debian8/rules b/distros/debian8/rules index 3bd92f7951..4e97df736b 100755 --- a/distros/debian8/rules +++ b/distros/debian8/rules @@ -72,6 +72,7 @@ override_dh_clean: done || true override_dh_install: + dh_install --fail-missing # # NOTE: This is a short-term kludge; hopefully changes in the next # upstream version will render this unnecessary. @@ -81,20 +82,20 @@ override_dh_install: dh_link var/cache/zoneminder/events usr/share/zoneminder/events dh_link var/cache/zoneminder/images usr/share/zoneminder/images dh_link var/cache/zoneminder/temp usr/share/zoneminder/temp - # - # This is a slightly lesser kludge; moving the cgi stuff to + # This is a slightly lesser kludge; moving the cgi stuff to # /usr/share/zoneminder/cgi-bin breaks one set of behavior, - # having it just in /usr/lib/cgi-bin breaks another bit of + # having it just in /usr/lib/cgi-bin breaks another bit of # behavior. # dh_link usr/lib/cgi-bin usr/share/zoneminder/cgi-bin - dh_install --fail-missing - override_dh_fixperms: dh_fixperms - chown root:root debian/zoneminder/etc/zm/zm.conf + # + # As requested by the Debian Webapps Policy Manual §3.2.1 + chown root:www-data debian/zoneminder/etc/zm/zm.conf + chmod 640 debian/zoneminder/etc/zm/zm.conf override_dh_auto_test: # do not run tests... diff --git a/distros/debian8/zoneminder.config b/distros/debian8/zoneminder.config new file mode 100644 index 0000000000..88cd626955 --- /dev/null +++ b/distros/debian8/zoneminder.config @@ -0,0 +1,134 @@ +#!/bin/sh +# config maintainer script for zoneminder + +set -e + +# Source the debconf stuff +. /usr/share/debconf/confmodule + +# Set the first version in which dbconfig-common was introduced in the package +dbc_first_version="1.28.0" + +# Source the config file if exists +CONFIGFILE=/etc/zm/zm.conf +if [ -e $CONFIGFILE ]; then + . $CONFIGFILE +fi + +if [ -f /usr/share/dbconfig-common/dpkg/config ]; then + + # Default use dbconfig-common + dbc_install="true" + + # Currently we only support mysql database + dbc_dbtypes="mysql" + + # Set authentication method to password + dbc_authmethod_user="password" + + # Re-use data from ZM config file + dbc_dbserver="$ZM_DB_HOST" + dbc_dbname="$ZM_DB_NAME" + dbc_dbuser="$ZM_DB_USER" + + # Source the dbconfig-common stuff + . /usr/share/dbconfig-common/dpkg/config +fi + +# Do this when the package is installed, upgraded or reconfigured +# Most of answers are cached so the questions will not be asked again +if [ "$1" = "configure" ] || [ "$1" = "reconfigure" ]; then + + # Ask the user if the database shall be installed locally or remotely + db_input high zoneminder/debconf_dblocation || true + db_go || true + db_get zoneminder/debconf_dblocation + + if [ "$RET" = "local" ]; then + if [ ! -e "/usr/sbin/mysqld" ]; then + # Display a message and exit if the user want a local database but + # no database server is available + db_input high zoneminder/debconf_dblocalmissingerror || true + db_go || true + exit 0 + else + # Set the database server to localhost + dbc_dbserver="localhost" + fi + else + # Source the dbconfig main configuration file + if [ -f /etc/dbconfig-common/config ]; then + . /etc/dbconfig-common/config + fi + if [ "$dbc_remote_questions_default" = "false" ]; then + # Display a message and exit if the dbconfig configuration does not + # allow installation of remote databases + # Note: To overcome this issue, we could think to override the + # default setting by using dbc_remote_questions_default='true' in + # maintainer scripts but unfortunately this does not work due to + # current dbconfig design + # More information here: + # https://bugs.launchpad.net/ubuntu/+source/dbconfig-common/+bug/1065331 + db_input high zoneminder/debconf_dbconfigerror || true + db_go || true + exit 0 + fi + fi + + # Ask the user for all database settings + dbc_go zoneminder $@ + + # Ask the user for the web server(s) to configure + db_input high zoneminder/webserver || true + db_go || true + + # Ask the user for the password of the database administrator if the user + # has not yet answered to this question. + # This situation may occur if the user skipped the database creation step + # when reconfiguring the package. + RET="" + db_get zoneminder/mysql/admin-pass + if [ -z "$RET" ]; then + db_input high zoneminder/mysql/admin-pass || true + db_go || true + fi + + # Do this only when not upgrading the package (no old version in argument) + if [ -z "$2" ]; then + # Ask for the password of 'admin' user + while :; do + RET="" + db_input high zoneminder/admin_password || true + db_go || true + db_get zoneminder/admin_password + # If password isn't empty we ask for password verification + if [ -z "$RET" ]; then + db_fset zoneminder/admin_password seen false + db_fset zoneminder/admin_password_again seen false + break + fi + ROOT_PW="$RET" + db_input high zoneminder/admin_password_again || true + db_go || true + db_get zoneminder/admin_password_again + if [ "$RET" = "$ROOT_PW" ]; then + ROOT_PW="" + break + fi + db_fset zoneminder/password_mismatch seen false + db_input critical zoneminder/password_mismatch || true + db_set zoneminder/admin_password "" + db_set zoneminder/admin_password_again "" + db_go || true + done + else + # If we are upgrading the package, set an empty password to disable + # password update in ZoneMinder database + db_set zoneminder/admin_password "" + fi + +fi + +#DEBHELPER# + +exit 0 diff --git a/distros/debian8/zoneminder.dirs b/distros/debian8/zoneminder.dirs index 4178482c18..eeb6a6c46b 100644 --- a/distros/debian8/zoneminder.dirs +++ b/distros/debian8/zoneminder.dirs @@ -4,3 +4,5 @@ var/cache/zoneminder/events var/cache/zoneminder/images var/cache/zoneminder/temp usr/share/zoneminder/db +usr/share/dbconfig-common/data/zoneminder/install +usr/share/dbconfig-common/data/zoneminder/upgrade/mysql diff --git a/distros/debian8/zoneminder.postinst b/distros/debian8/zoneminder.postinst index 6229f9b78c..5969e96939 100644 --- a/distros/debian8/zoneminder.postinst +++ b/distros/debian8/zoneminder.postinst @@ -1,68 +1,180 @@ #! /bin/sh +# postinst maintainer script for zoneminder set -e +# Source the debconf stuff +. /usr/share/debconf/confmodule + +# Source the config file if exists +CONFIGFILE=/etc/zm/zm.conf +if [ -e $CONFIGFILE ]; then + . $CONFIGFILE +fi + apache_install() { - mkdir -p /etc/apache2/conf-available - ln -sf ../../zm/apache.conf /etc/apache2/conf-available/zoneminder.conf - COMMON_STATE=$(dpkg-query -f '${Status}' -W 'apache2.2-common' 2>/dev/null | awk '{print $3}' || true) + mkdir -p /etc/apache2/conf-available + ln -sf ../../zm/apache.conf /etc/apache2/conf-available/zoneminder.conf + + COMMON_STATE=$(dpkg-query -f '${Status}' -W 'apache2.2-common' 2>/dev/null | awk '{print $3}' || true) + + if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then + . /usr/share/apache2/apache2-maintscript-helper + apache2_invoke enconf zoneminder + elif [ "$COMMON_STATE" = "installed" ] || [ "$COMMON_STATE" = "unpacked" ] ; then + [ -d /etc/apache2/conf.d/ ] && [ ! -L /etc/apache2/conf.d/zoneminder.conf ] && ln -s ../conf-available/zoneminder.conf /etc/apache2/conf.d/zoneminder.conf + fi + + # Enable CGI script module in apache (not enabled by default on jessie) + a2enmod cgi >/dev/null 2>&1 + + # Reload the web server + deb-systemd-invoke reload apache2.service || true +} + +mysql_update() { + + # Source the dbconfig stuff + . /usr/share/dbconfig-common/internal/mysql - if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then - . /usr/share/apache2/apache2-maintscript-helper - apache2_invoke enconf zoneminder - elif [ "$COMMON_STATE" = "installed" ] || [ "$COMMON_STATE" = "unpacked" ] ; then - [ -d /etc/apache2/conf.d/ ] && [ ! -L /etc/apache2/conf.d/zoneminder.conf ] && ln -s ../conf-available/zoneminder.conf /etc/apache2/conf.d/zoneminder.conf - fi + # Update the password of the hard-coded default 'admin' account + test -z $ADMIN_PASSWORD || dbc_mysql_exec_command "UPDATE Users SET Password = password('$ADMIN_PASSWORD') WHERE Username = 'admin';" || true + + # Update the database version + dbc_mysql_exec_command "UPDATE Config SET Value = '$DB_VERSION' WHERE Name = 'ZM_DYN_DB_VERSION';" || true } -if [ "$1" = "configure" ]; then - if [ -e "/etc/init.d/mysql" ]; 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 - - deb-systemd-invoke stop zoneminder.service || true - zmupdate.pl --nointeractive - - else - echo 'NOTE: mysql not running, please start mysql and run dpkg-reconfigure zoneminder when it is running.' - fi - else - echo 'mysql not found, assuming remote server.' - 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 +if [ -f /usr/share/dbconfig-common/dpkg/postinst ]; then + + # Set the first version in which dbconfig-common was introduced in the package + dbc_first_version="1.28.0" + + # Set the database type + dbc_dbtypes="mysql" + + # Source the dbconfig-common stuff + . /usr/share/dbconfig-common/dpkg/postinst +fi + +# Do this when the package is installed, upgraded or reconfigured +if [ "$1" = "configure" ] || [ "$1" = "reconfigure" ]; then + + # Install sql database create file for dbconfig + # (needed at first package installation) + if [ ! -f /usr/share/dbconfig-common/data/zoneminder/install/mysql ]; then + install -m 644 /usr/share/zoneminder/db/zm_create.sql \ + /usr/share/dbconfig-common/data/zoneminder/install/mysql + # Remove unneeded sql requests + # dbconfig will create the underlying database + sed -i "/^ *CREATE DATABASE /d" \ + /usr/share/dbconfig-common/data/zoneminder/install/mysql + sed -i "/^ *USE /d" \ + /usr/share/dbconfig-common/data/zoneminder/install/mysql + fi + + # Symlink sql update files for dbconfig (needed when upgrading the package) + for sqlfile in /usr/share/zoneminder/db/zm_update-*.sql; do + lnk=`echo $sqlfile | sed "s/^\/usr\/share\/zoneminder\/db\/zm_update-\(.*\)\.sql/\1/"` + if [ ! -L /usr/share/dbconfig-common/data/zoneminder/upgrade/mysql/$lnk ]; then + ln -sf $sqlfile \ + /usr/share/dbconfig-common/data/zoneminder/upgrade/mysql/$lnk + fi + done || true + + # Create the underlying database and populate it + # dbconfig will take care of applying any updates which are newer than the + # previously installed version + dbc_go zoneminder $@ + + # Get the password of ZoneMinder user 'admin' from debconf + db_get zoneminder/admin_password + ADMIN_PASSWORD=$RET + + # Remove the password from debconf database + test -z $ADMIN_PASSWORD || db_reset zoneminder/admin_password || true + + # Get the lastest database version from dbconfig upgrade folder + DB_VERSION=$(ls -rv /usr/share/dbconfig-common/data/zoneminder/upgrade/$dbc_dbtypes | head -1) + + # Update the default admin account and database version + mysql_update + + # Retrieve data from dbconfig (inputs from user) + . /etc/dbconfig-common/zoneminder.conf + + # ZoneMinder config file handling + # Inspired by: http://manpages.debian.org/cgi-bin/man.cgi?query=debconf-devel&sektion=7 + + # Backup the config file + cp -a -f $CONFIGFILE ${CONFIGFILE}.postinst.bak + + # Redeclare variables if missing in config file + test -z $dbc_dbserver || grep -Eq "^ *ZM_DB_HOST=" $CONFIGFILE \ + || echo "ZM_DB_HOST=" >> ${CONFIGFILE}.postinst.bak + test -z $dbc_dbname || grep -Eq "^ *ZM_DB_NAME=" $CONFIGFILE \ + || echo "ZM_DB_NAME=" >> ${CONFIGFILE}.postinst.bak + test -z $dbc_dbuser || grep -Eq "^ *ZM_DB_USER=" $CONFIGFILE \ + || echo "ZM_DB_USER=" >> ${CONFIGFILE}.postinst.bak + test -z $dbc_dbpass || grep -Eq "^ *ZM_DB_PASS=" $CONFIGFILE \ + || echo "ZM_DB_PASS=" >> ${CONFIGFILE}.postinst.bak + + # Prevent ZM_DB_HOST to be empty if user selected the 'unix socket' method + if test -z $dbc_dbserver; then + dbc_dbserver_override="localhost" + else + dbc_dbserver_override=$dbc_dbserver + fi + + # Update variables in config file + sed -i "s/^ *ZM_DB_HOST=.*/ZM_DB_HOST=$dbc_dbserver_override/" \ + ${CONFIGFILE}.postinst.bak + test -z $dbc_dbname || sed -i "s/^ *ZM_DB_NAME=.*/ZM_DB_NAME=$dbc_dbname/" \ + ${CONFIGFILE}.postinst.bak + test -z $dbc_dbuser || sed -i "s/^ *ZM_DB_USER=.*/ZM_DB_USER=$dbc_dbuser/" \ + ${CONFIGFILE}.postinst.bak + test -z $dbc_dbpass || sed -i "s/^ *ZM_DB_PASS=.*/ZM_DB_PASS=$dbc_dbpass/" \ + ${CONFIGFILE}.postinst.bak + + # Clean-up backup file + mv -f ${CONFIGFILE}.postinst.bak $CONFIGFILE + + + # Set some file permissions + chown $ZM_WEB_USER:$ZM_WEB_GROUP /var/log/zm + chown $ZM_WEB_USER:$ZM_WEB_GROUP /var/lib/zm + if [ -z "$2" ]; then + chown $ZM_WEB_USER:$ZM_WEB_GROUP -R /var/cache/zoneminder + fi + # As requested by the Debian Webapps Policy Manual §3.2.1 + chown root:$ZM_WEB_GROUP /etc/zm/zm.conf + chmod 640 /etc/zm/zm.conf + + # Configure the web server + db_get zoneminder/webserver + webservers="$RET" + + for webserver in $webservers; do + webserver=${webserver%,} + # Currently we only support apache2 + if [ "$webserver" = "apache2" ] ; then + apache_install $1 + fi + done fi -# Ensure zoneminder is stopped... -deb-systemd-invoke stop zoneminder.service || exit $? - -if [ "$1" = "configure" ]; then - if [ -z "$2" ]; then - chown www-data:www-data /var/log/zm - chown www-data:www-data /var/lib/zm/ - chown www-data:www-data -R /var/cache/zoneminder - else - chown www-data:www-data /var/log/zm - zmupdate.pl - fi - apache_install $1 - a2enmod cgi >/dev/null 2>&1 - if [ -f /etc/init.d/apache2 ] ; then - invoke-rc.d apache2 reload 3>/dev/null || true - fi + +# Do this every time the package is installed or upgraded +# Test for database presence to avoid failure of zmupdate.pl +if [ "$dbc_install" = "true" ] && [ "$1" = "configure" ]; then + + # Ensure zoneminder is stopped + deb-systemd-invoke stop zoneminder.service || exit $? + + # Run the ZoneMinder update tool + zmupdate.pl + fi + #DEBHELPER# + +exit 0 diff --git a/distros/debian8/zoneminder.postrm b/distros/debian8/zoneminder.postrm index 27f4402902..d5cd11ebde 100644 --- a/distros/debian8/zoneminder.postrm +++ b/distros/debian8/zoneminder.postrm @@ -1,7 +1,13 @@ #! /bin/sh +# postrm maintainer script for zoneminder set -e +# Source the debconf stuff +if [ -f /usr/share/debconf/confmodule ]; then + . /usr/share/debconf/confmodule +fi + apache_remove() { COMMON_STATE=$(dpkg-query -f '${Status}' -W 'apache2.2-common' 2>/dev/null | awk '{print $3}' || true) if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then @@ -11,22 +17,62 @@ apache_remove() { rm -f /etc/apache2/conf.d/zoneminder.conf fi rm -f /etc/apache2/conf-available/zoneminder.conf + # Reload the web server + deb-systemd-invoke reload apache2.service || true } +# Source the dbconfig stuff +if [ -f /usr/share/dbconfig-common/dpkg/postrm ]; then + . /usr/share/dbconfig-common/dpkg/postrm + # Ask the user what do to with dbconfig when removing the package + dbc_go zoneminder $@ +fi + if [ "$1" = "remove" ] || [ "$1" = "purge" ]; then - apache_remove $1 - if [ -f /etc/init.d/apache2 ] ; then - invoke-rc.d apache2 reload 3>/dev/null || true - fi + + # Deconfigure the web server + db_get zoneminder/webserver + for webserver in $RET; do + webserver=${webserver%,} + # Currently we only support apache2 + if [ "$webserver" = "apache2" ] ; then + apache_remove $1 + fi + done + + # Remove dbconfig stuff added in postinst script + rm -rf /usr/share/dbconfig-common/data/zoneminder + + # No need to manually remove the zm database, dbconfig take care of this fi if [ "$1" = "purge" ]; then - if [ -e "/etc/init.d/mysql" ]; then - echo 'delete from user where User="zmuser";' | mysql --defaults-file=/etc/mysql/debian.cnf mysql - echo 'delete from db where User="zmuser";' | mysql --defaults-file=/etc/mysql/debian.cnf mysql - mysqladmin --defaults-file=/etc/mysql/debian.cnf -f drop zm - else - echo 'mysql not found, assuming remote server.' + + # Delete a potential remaining file used in postinst script + rm -f /etc/zm/zm.conf.postinst.bak + + # Ask the user if we have to remove the cache directory even if not empty + if [ -d /var/cache/zoneminder ] \ + && [ ! $(find /var/cache/zoneminder -maxdepth 0 -type d -empty 2>/dev/null) ]; then + RET="" + db_input high zoneminder/ask_delete || true + db_go || true + db_get zoneminder/ask_delete + if [ "$RET" = "true" ]; then + RET="" + db_input high zoneminder/ask_delete_again || true + db_go || true + db_get zoneminder/ask_delete_again + if [ "$RET" = "true" ]; then + rm -rf /var/cache/zoneminder + fi + fi fi fi + #DEBHELPER# + +# postrm rm may freeze without that +db_stop + +exit 0 diff --git a/distros/debian8/zoneminder.preinst b/distros/debian8/zoneminder.preinst index 6cd01ba559..f9c518431e 100644 --- a/distros/debian8/zoneminder.preinst +++ b/distros/debian8/zoneminder.preinst @@ -1,4 +1,5 @@ #!/bin/sh +# preinst maintainer script for zoneminder set -e @@ -17,7 +18,7 @@ if [ -L /usr/share/zoneminder/images ]; then fi if [ "$abort" = "true" ]; then - cat >&2 << EOF + cat >&2 << EOF Aborting installation of zoneminder due to non-default symlinks in /usr/share/zoneminder for the images and/or events directory, which could result in loss of data. Please move your data in each of these directories to diff --git a/distros/debian8/zoneminder.prerm b/distros/debian8/zoneminder.prerm new file mode 100644 index 0000000000..0adf963e5b --- /dev/null +++ b/distros/debian8/zoneminder.prerm @@ -0,0 +1,22 @@ +#!/bin/sh +# prerm script for zoneminder + +set -e + +# Source the debconf stuff if file exists +if [ -f /usr/share/debconf/confmodule ]; then + . /usr/share/debconf/confmodule +fi + +# If dbconfig-common is installed and has been used by zoneminder +if [ -f /usr/share/dbconfig-common/dpkg/prerm ] \ + && [ -f /etc/dbconfig-common/zoneminder.conf ]; then + # Source the dbconfig stuff + . /usr/share/dbconfig-common/dpkg/prerm + # Ask the user what do to with dbconfig before removing the package + dbc_go zoneminder $@ +fi + +# #DEBHELPER# + +exit 0 diff --git a/distros/debian8/zoneminder.service b/distros/debian8/zoneminder.service index d788f90c7f..78f950acad 100644 --- a/distros/debian8/zoneminder.service +++ b/distros/debian8/zoneminder.service @@ -4,7 +4,8 @@ [Unit] Description=ZoneMinder CCTV recording and security system After=network.target mysql.service apache2.service -Requires=mysql.service apache2.service +Requires=apache2.service +Wants=mysql.service [Service] User=www-data diff --git a/distros/debian8/zoneminder.templates b/distros/debian8/zoneminder.templates new file mode 100644 index 0000000000..9b1c21b983 --- /dev/null +++ b/distros/debian8/zoneminder.templates @@ -0,0 +1,86 @@ +Template: zoneminder/debconf_dblocation +Type: select +__Choices: local, remote +Default: local +_Description: Database location: + A database server is required to run ZoneMinder. The database can be installed + either locally or remotely on a machine of your network. + . + If you choose a remote location, you will have to select the 'tcp/ip' + connection method and enter the hostname or ip address of the remote machine + in the next configuration screens. + +Template: zoneminder/debconf_dblocalmissingerror +Type: error +_Description: No local database server is available: + Currently ZoneMinder supports mysql or mariadb database server but none of them + appears to be installed on this machine. + . + In order to complete ZoneMinder's installation, after ending of this assistant, + please install a compatible database server and then restart the assistant by + invoking: + . + $ sudo dpkg-reconfigure zoneminder + +Template: zoneminder/debconf_dbconfigerror +Type: error +_Description: Remote database servers are not allowed: + The current configuration of dbconfig-common does not allow installation of + a database on remote servers. + . + In order to reconfigure dbconfig-common, please invoke the following command + after ending of this assistant: + . + $ sudo dpkg-reconfigure dbconfig-common + . + Then, to complete ZoneMinder's installation, please restart this assistant by + invoking: + . + $ sudo dpkg-reconfigure zoneminder + +Template: zoneminder/webserver +Type: multiselect +Choices: apache2 +Default: apache2 +_Description: Web server to reconfigure automatically: + Please choose the web server that should be automatically configured for + ZoneMinder's web portal access. + +Template: zoneminder/admin_password +Type: password +_Description: New password for the ZoneMinder 'admin' user: + Please enter the password of the default administrative user. + . + While not mandatory, it is highly recommended that you set a custom password + for the administrative 'admin' user. + . + If this field is left blank, the password will not be changed. + +Template: zoneminder/admin_password_again +Type: password +_Description: Repeat password for the ZoneMinder 'admin' user: + +Template: zoneminder/password_mismatch +Type: error +_Description: Password input error + The two passwords you entered were not the same. Please try again. + +Template: zoneminder/ask_delete +Type: boolean +Default: false +_Description: Delete this non empty directory? + A purge of the ZoneMinder package is performed but the directory + '/var/cache/zoneminder' is not empty so it will not be deleted. + . + Please consider that this directory is designed to contain data resulting from + event detection. Therefore, "proof of evidence" could be lost!" + . + If you are not sure of your decision, please do not delete this directory but + perform a manual checkup. + +Template: zoneminder/ask_delete_again +Type: boolean +Default: false +_Description: Deletion confirmed? + You have allowed the deletion of directory '/var/cache/zoneminder' although + it may contain critical data.