Autoconf: Fix database validation

refs #4941
This commit is contained in:
Marius Hein 2013-10-22 13:32:10 +02:00
parent 204e1941c6
commit f770075276
4 changed files with 39 additions and 2 deletions

View File

@ -471,7 +471,7 @@ exec { 'create-mysql-icingaweb-db':
unless => 'mysql -uicingaweb -picinga icingaweb',
command => 'mysql -uroot -e "CREATE DATABASE icingaweb; \
GRANT ALL ON icingaweb.* TO icingaweb@localhost \
IDENTIFIED BY \'icinga\';"',
IDENTIFIED BY \'icingaweb\';"',
require => Service['mysqld']
}

11
aclocal.m4 vendored
View File

@ -52,7 +52,6 @@ AC_DEFUN([AC_CHECK_BIN], [
test "XX${$1}" == "XXnot found" && $1=""
])
AC_DEFUN([AC_PATH_GUESS], [
$2=$3
for x in $1; do
@ -63,3 +62,13 @@ AC_DEFUN([AC_PATH_GUESS], [
)
done
])
# ICINGA_CHECK_DBTYPE(DBTYPE, ARGUMENT_NAME)
# ------------------------------------------
AC_DEFUN([ICINGA_CHECK_DBTYPE], [
AC_MSG_CHECKING([Testing database type for $2])
AS_IF(echo "$1" | $GREP -q "^\(my\|pg\)sql$",
AC_MSG_RESULT([OK ($1)]),
AC_MSG_ERROR([$1])
)
])

24
configure vendored
View File

@ -2358,6 +2358,18 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking Testing database type for --with-internal-db-type" >&5
$as_echo_n "checking Testing database type for --with-internal-db-type... " >&6; }
if echo "$internal_db_type" | $GREP -q "^\(my\|pg\)sql$"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: OK ($internal_db_type)" >&5
$as_echo "OK ($internal_db_type)" >&6; }
else
as_fn_error $? "$internal_db_type" "$LINENO" 5
fi
# Check whether --with-internal_db_name was given.
if test "${with_internal_db_name+set}" = set; then :
withval=$with_internal_db_name; internal_db_name=$withval
@ -2564,6 +2576,18 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking Testing database type for --with-ido-db-type" >&5
$as_echo_n "checking Testing database type for --with-ido-db-type... " >&6; }
if echo "$ido_db_type" | $GREP -q "^\(my\|pg\)sql$"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: OK ($ido_db_type)" >&5
$as_echo "OK ($ido_db_type)" >&6; }
else
as_fn_error $? "$ido_db_type" "$LINENO" 5
fi
# Check whether --with-ido_host was given.
if test "${with_ido_host+set}" = set; then :
withval=$with_ido_host; ido_host=$withval

View File

@ -98,6 +98,8 @@ AC_ARG_WITH([internal_db_type],
internal_db_type=mysql
)
ICINGA_CHECK_DBTYPE($internal_db_type, [--with-internal-db-type])
AC_ARG_WITH([internal_db_name],
AS_HELP_STRING([--with-internal-db-name=NAME], [database name to use for internal database (default icingaweb)]),
internal_db_name=$withval,
@ -228,6 +230,8 @@ AC_ARG_WITH([ido_db_type],
ido_db_type="mysql"
)
ICINGA_CHECK_DBTYPE($ido_db_type, [--with-ido-db-type])
AC_ARG_WITH([ido_host],
AS_HELP_STRING([--with-ido-host=HOST], [host to use for retrieving data from the ido db (default: localhost)]),
ido_host=$withval,