2014-12-01 00:55:26 +08:00
|
|
|
#!/bin/sh
|
2014-12-02 07:58:18 +08:00
|
|
|
# config maintainer script for zoneminder
|
2014-12-01 00:55:26 +08:00
|
|
|
|
2014-12-03 20:40:30 +08:00
|
|
|
set -x
|
2014-12-01 00:55:26 +08:00
|
|
|
|
2014-12-02 07:58:18 +08:00
|
|
|
# Source the debconf stuff
|
2014-12-01 00:55:26 +08:00
|
|
|
. /usr/share/debconf/confmodule
|
|
|
|
|
2014-12-03 20:40:30 +08:00
|
|
|
CONFIGFILE=/etc/zm/zm.conf
|
|
|
|
|
2014-12-01 00:55:26 +08:00
|
|
|
# Ask the user if debconf shall be used to configure the package
|
2014-12-03 20:40:30 +08:00
|
|
|
db_set zoneminder/debconf_install true
|
2014-12-01 00:55:26 +08:00
|
|
|
db_input high zoneminder/debconf_install || true
|
|
|
|
db_go || true
|
|
|
|
|
2014-12-04 01:22:19 +08:00
|
|
|
# Exit if the user does not want to use debconf
|
2014-12-03 20:40:30 +08:00
|
|
|
db_get zoneminder/debconf_install
|
2014-12-01 00:55:26 +08:00
|
|
|
if [ "$RET" = false ]; then
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2014-12-02 07:58:18 +08:00
|
|
|
# Source the config file if exists
|
|
|
|
if [ -e $CONFIGFILE ]; then
|
|
|
|
. $CONFIGFILE || true
|
|
|
|
else
|
2014-12-04 01:22:19 +08:00
|
|
|
# Exit with error if no config file
|
|
|
|
exit 1
|
2014-12-02 07:58:18 +08:00
|
|
|
fi
|
2014-12-01 00:55:26 +08:00
|
|
|
|
2014-12-02 07:58:18 +08:00
|
|
|
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 [ ! -e "/usr/sbin/mysqld" ]; then
|
|
|
|
db_input high zoneminder/debconf_dbremote || true
|
|
|
|
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
|
|
|
|
fi
|
2014-12-04 01:22:19 +08:00
|
|
|
else
|
|
|
|
# Exit with error, currently we only support mysql
|
|
|
|
exit 1
|
2014-12-02 07:58:18 +08:00
|
|
|
fi
|
2014-12-01 00:55:26 +08:00
|
|
|
|
2014-12-02 07:58:18 +08:00
|
|
|
if [ -f /usr/share/dbconfig-common/dpkg/config ]; then
|
|
|
|
# Set the first version in which dbconfig-common was introduced in the package
|
|
|
|
dbc_first_version="1.28.0"
|
2014-12-01 00:55:26 +08:00
|
|
|
|
2014-12-02 07:58:18 +08:00
|
|
|
# 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"
|
2014-12-01 00:55:26 +08:00
|
|
|
|
2014-12-02 07:58:18 +08:00
|
|
|
# Source the dbconfig-common stuff
|
|
|
|
. /usr/share/dbconfig-common/dpkg/config
|
|
|
|
|
|
|
|
# Ask the user for all other settings about the database
|
|
|
|
dbc_go zoneminder $@
|
2014-12-01 00:55:26 +08:00
|
|
|
fi
|
|
|
|
|
2014-12-02 07:58:18 +08:00
|
|
|
# Ask the user for the administrator login and password
|
|
|
|
db_input high zoneminder/admin_login || true
|
|
|
|
db_input high zoneminder/admin_password || true
|
|
|
|
db_go || true
|
|
|
|
|
|
|
|
# Ask the user for the web server(s) to configure
|
|
|
|
db_input high zoneminder/webserver || true
|
|
|
|
db_go || true
|
|
|
|
|
2014-12-03 21:12:26 +08:00
|
|
|
#DEBHELPER#
|
|
|
|
|
2014-12-01 00:55:26 +08:00
|
|
|
exit 0
|