Merge branch 'debconf_support3' into debconf_support
commit
700aca0769
|
@ -1,22 +1,25 @@
|
|||
#!/bin/sh
|
||||
# config maintainer script for zoneminder
|
||||
|
||||
set -x
|
||||
set -e
|
||||
|
||||
# Source the debconf stuff
|
||||
. /usr/share/debconf/confmodule
|
||||
|
||||
CONFIGFILE=/etc/zm/zm.conf
|
||||
|
||||
# Ask the user if debconf shall be used to configure the package
|
||||
db_set zoneminder/debconf_install true
|
||||
db_input high zoneminder/debconf_install || true
|
||||
db_go || true
|
||||
if [ "$1" = "configure" ]; then
|
||||
|
||||
# Exit if the user does not want to use debconf
|
||||
db_get zoneminder/debconf_install
|
||||
if [ "$RET" = false ]; then
|
||||
exit 0
|
||||
# Ask the user if debconf shall be used to configure the package
|
||||
db_set zoneminder/debconf_install true
|
||||
db_input high zoneminder/debconf_install || true
|
||||
db_go || true
|
||||
|
||||
# Exit if the user does not want to use debconf
|
||||
db_get zoneminder/debconf_install
|
||||
if [ "$RET" = "false" ]; then
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
# Source the config file if exists
|
||||
|
@ -24,36 +27,74 @@ if [ -e $CONFIGFILE ]; then
|
|||
. $CONFIGFILE || true
|
||||
else
|
||||
# Exit with error if no config file
|
||||
db_input high zoneminder/debconf_confmissingerror || true
|
||||
db_go || true
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$ZM_DB_TYPE" = mysql ]; then
|
||||
# Check if the database server exists on the local machine
|
||||
# If no, ask the user if this is intentional (remote database server)
|
||||
if [ ! "$ZM_DB_TYPE" = "mysql" ]; then
|
||||
# Exit with error, currently we only support mysql
|
||||
db_input high zoneminder/debconf_dbtypeerror || true
|
||||
db_go || true
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Ask the user if the database shall be installed locally or remotely
|
||||
db_input high zoneminder/debconf_dblocation
|
||||
db_go || true
|
||||
db_get zoneminder/debconf_dblocation
|
||||
if [ "$RET" = "local" ]; then
|
||||
if [ ! -e "/usr/sbin/mysqld" ]; then
|
||||
db_input high zoneminder/debconf_dbremote || true
|
||||
# Display a message and exit if the user want a local database but no
|
||||
# database server is available
|
||||
db_input high zoneminder/debconf_dblocalmissingerror
|
||||
db_go || true
|
||||
db_get zoneminder/debconf_dbremote
|
||||
if [ "$RET" = false ]; then
|
||||
# Exit if the user forgot to install the database server
|
||||
exit 0
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
# Set the database server to localhost
|
||||
dbc_dbserver="localhost"
|
||||
else
|
||||
# Exit with error, currently we only support mysql
|
||||
exit 1
|
||||
# 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 databases on remote servers from this assistant
|
||||
# Note: It would be nice to override the default configuration by setting
|
||||
# dbc_remote_questions_default to true here but unfortunately this does
|
||||
# not work
|
||||
# https://bugs.launchpad.net/ubuntu/+source/dbconfig-common/+bug/1065331
|
||||
db_input high zoneminder/debconf_dbconfigerror
|
||||
db_go || true
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -f /usr/share/dbconfig-common/dpkg/config ]; then
|
||||
# Set the first version in which dbconfig-common was introduced in the package
|
||||
|
||||
# Set the first version in which dbconfig-common was introduced in the
|
||||
# package
|
||||
dbc_first_version="1.28.0"
|
||||
|
||||
# Initialize debconf with data from ZoneMinder
|
||||
dbc_dbtypes="$ZM_DB_TYPE"
|
||||
dbc_dbserver="$ZM_DB_HOST"
|
||||
dbc_dbname="$ZM_DB_NAME"
|
||||
dbc_dbuser="$ZM_DB_USER"
|
||||
dbc_dbpass="$ZM_DB_PASS"
|
||||
# Currently we only support mysql database
|
||||
dbc_dbtypes="mysql"
|
||||
|
||||
# Set authentication method to password
|
||||
dbc_authmethod_user="password"
|
||||
|
||||
if [ "$1" = "configure" ] || [ "$1" = "reconfigure" ]; then
|
||||
# Force the use of the database name and application user name set in
|
||||
# the zoneminder configuration file
|
||||
dbc_dbname="$ZM_DB_NAME"
|
||||
dbc_dbuser="$ZM_DB_USER"
|
||||
fi
|
||||
|
||||
# Reuse custom hostname and password when reconfiguring
|
||||
if [ "$1" = "reconfigure" ]; then
|
||||
dbc_dbserver="$ZM_DB_HOST"
|
||||
dbc_dbpass="$ZM_DB_PASS"
|
||||
fi
|
||||
|
||||
# Source the dbconfig-common stuff
|
||||
. /usr/share/dbconfig-common/dpkg/config
|
||||
|
|
|
@ -1,15 +1,13 @@
|
|||
#! /bin/sh
|
||||
# postinst maintainer script for zoneminder
|
||||
|
||||
set -x
|
||||
set -e
|
||||
|
||||
# Source the debconf stuff
|
||||
. /usr/share/debconf/confmodule
|
||||
|
||||
CONFIGFILE=/etc/zm/zm.conf
|
||||
|
||||
old_version=$2
|
||||
|
||||
apache_install() {
|
||||
mkdir -p /etc/apache2/conf-available
|
||||
ln -sf ../../zm/apache.conf /etc/apache2/conf-available/zoneminder.conf
|
||||
|
@ -49,25 +47,7 @@ if [ "$RET" = "false" ]; then
|
|||
fi
|
||||
|
||||
# Source the config file if exists
|
||||
if [ -e $CONFIGFILE ]; then
|
||||
. $CONFIGFILE || true
|
||||
else
|
||||
# Exit with error if no config file
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$ZM_DB_TYPE" = "mysql" ]; then
|
||||
if [ ! -e "/usr/sbin/mysqld" ]; then
|
||||
db_get zoneminder/debconf_dbremote
|
||||
if [ "$RET" = "false" ]; then
|
||||
# Exit silently if the user forgot to install the database server
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
else
|
||||
# Currently we only support mysql
|
||||
exit 1
|
||||
fi
|
||||
. $CONFIGFILE
|
||||
|
||||
if [ -f /usr/share/dbconfig-common/dpkg/postinst ]; then
|
||||
|
||||
|
|
|
@ -1,6 +1,12 @@
|
|||
#! /bin/sh
|
||||
# postrm maintainer script for zoneminder
|
||||
|
||||
set -x
|
||||
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)
|
||||
|
@ -15,25 +21,26 @@ apache_remove() {
|
|||
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
|
||||
|
||||
if [ -e /usr/share/debconf/confmodule ]; then
|
||||
# Deconfigure the web server
|
||||
db_get zoneminder/webserver
|
||||
|
||||
# Source the debconf stuff
|
||||
. /usr/share/debconf/confmodule
|
||||
|
||||
# Deconfigure 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_remove $1
|
||||
fi
|
||||
done
|
||||
fi
|
||||
webservers="$RET"
|
||||
for webserver in $webservers; do
|
||||
webserver=${webserver%,}
|
||||
# Currently we only support apache2
|
||||
if [ "$webserver" = "apache2" ] ; then
|
||||
apache_remove $1
|
||||
fi
|
||||
done
|
||||
|
||||
# No need to manually remove the zm database and user, dbconfig take care of this
|
||||
fi
|
||||
|
@ -46,4 +53,7 @@ fi
|
|||
|
||||
#DEBHELPER#
|
||||
|
||||
# postrm rm may freeze without that
|
||||
db_stop
|
||||
|
||||
exit 0
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#!/bin/sh
|
||||
# preinst maintainer script for zoneminder
|
||||
|
||||
set -x
|
||||
set -e
|
||||
|
||||
abort=false
|
||||
if [ -L /usr/share/zoneminder/events ]; then
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
#!/bin/sh
|
||||
# prerm script for zoneminder
|
||||
|
||||
set -e
|
||||
|
||||
# Source the debconf stuff
|
||||
if [ -f /usr/share/debconf/confmodule ]; then
|
||||
. /usr/share/debconf/confmodule
|
||||
fi
|
||||
|
||||
# Source the dbconfig stuff
|
||||
if [ /usr/share/dbconfig-common/dpkg/prerm ]; then
|
||||
. /usr/share/dbconfig-common/dpkg/prerm
|
||||
# Ask the user what do to with dbconfig when removing the package
|
||||
dbc_go zoneminder $@
|
||||
fi
|
||||
|
||||
# #DEBHELPER#
|
||||
|
||||
exit 0
|
|
@ -1,9 +1,10 @@
|
|||
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
|
||||
to run ZoneMinder.
|
||||
Please choose the web server that should be automatically configure to run
|
||||
ZoneMinder.
|
||||
|
||||
Template: zoneminder/admin_login
|
||||
Type: string
|
||||
|
@ -17,28 +18,59 @@ Default: admin
|
|||
Description: Administrative user's password:
|
||||
Please enter the password of the administrative user.
|
||||
|
||||
Template: zoneminder/debconf_dbremote
|
||||
Type: boolean
|
||||
Default: true
|
||||
Description: Do you want to use a remote database server?
|
||||
A database server is required to run ZoneMinder.
|
||||
Template: zoneminder/debconf_dbconfigerror
|
||||
Type: error
|
||||
Description: Remote database servers not allowed:
|
||||
The current configuration of dbconfig-common does not allow installation of
|
||||
databases on remote servers from this assistant.
|
||||
.
|
||||
The database server can be installed either locally on this machine or remotely
|
||||
on a machine of your local network.
|
||||
This program will abort so you can reconfigure dbconfig-common by invoking the
|
||||
command below and the restart the installation of ZoneMinder:
|
||||
.
|
||||
Currently ZoneMinder supports MySQL server or MariaDB server but none of them
|
||||
sudo dpkg-reconfigure dbconfig-common
|
||||
|
||||
Template: zoneminder/debconf_dblocalmissingerror
|
||||
Type: error
|
||||
Description: Local database server is missing:
|
||||
Currently ZoneMinder supports mysql or mariadb database server but none of them
|
||||
appears to be installed on this machine.
|
||||
.
|
||||
If this is intentional and you want to use a remote database, please choose Yes.
|
||||
The program will continue and you will have to select the TCP/IP connection
|
||||
method when asked.
|
||||
This program will abort so you can install a database server and then restart
|
||||
the installation of ZoneMinder.
|
||||
|
||||
Template: zoneminder/debconf_dbtypeerror
|
||||
Type: error
|
||||
Description: Wrong database type:
|
||||
The database type specified in the configuration file '/etc/zm/zm.conf' is
|
||||
not set to 'mysql'.
|
||||
.
|
||||
If you want to install the database server on this machine, please choose 'No'.
|
||||
The program will abort so you can install the database and then come back to this
|
||||
program by invoking 'sudo dpkg-reconfigure zoneminder' on the command line.
|
||||
This program will abort so you can fix the configuration file and then restart
|
||||
the installation of ZoneMinder.
|
||||
|
||||
Template: zoneminder/debconf_confmissingerror
|
||||
Type: error
|
||||
Description: Configuration file is missing:
|
||||
ZoneMinder installation is corrupted.
|
||||
.
|
||||
The main configuration file '/etc/zm/zm.conf' is missing.
|
||||
|
||||
Template: zoneminder/debconf_dblocation
|
||||
Type: select
|
||||
Choices: local, remote
|
||||
Default: local
|
||||
Description: Database location:
|
||||
A database server is required to run ZoneMinder. This database can be installed
|
||||
either locally or remotely on a machine of your local network.
|
||||
.
|
||||
Please select the location of your database.
|
||||
.
|
||||
If you choose a remote location, in the next screens, you will have to select
|
||||
the 'tcp/ip' connection method and enter the hostname / ip address of the
|
||||
remote machine.
|
||||
|
||||
Template: zoneminder/debconf_install
|
||||
Type: boolean
|
||||
Default: true
|
||||
Description: Configure ZoneMinder automatically?
|
||||
The configuration program for the package can configure automatically ZoneMinder.
|
||||
The configuration program for the package can configure automatically
|
||||
ZoneMinder.
|
||||
|
|
Loading…
Reference in New Issue