nagios4/debian/nagios4-cgi.config

69 lines
1.9 KiB
Bash

#!/bin/sh -e
. /usr/share/debconf/confmodule
# (taken from the webapps-common httpd functions)
# wc_httpd_installed: test for installed httpds
# usage:
# wc_httpd_installed [ httpd1 httpd2 ... ]
#
# no arguments implies to test for all servers
wc_httpd_installed(){
local httpds
if [ "$*" ]; then
httpds=$*
else
httpds=$wc_httpd_supported
fi
for f in $httpds; do
if test -x /usr/sbin/$f; then
echo $f
fi
done
}
# list of installed servers to check for
default_servers=`wc_httpd_installed apache2 apache apache-ssl apache-perl`
# convert list to comma seperated list
server_list=`echo $default_servers | sed -e 's/[[:space:]][[:space:]]*/, /g'`
# if they haven't already been prompted, preseed the server selection
db_fget nagios4/httpd seen
if [ "$RET" = "false" ]; then
db_set nagios4/httpd $server_list
fi
db_input medium nagios4/httpd || true
db_go || true
db_get nagios4/httpd
keepgoing="$RET"
if [ "$keepgoing" ]; then
db_input medium nagios4/nagios1-in-apacheconf || true
# the passwords are reset at the end of every postinst run,
# however, they are left in the "seen" state so that the
# admin is not prompted for them at every upgrade.
while [ ! "$passwordsmatch" ]; do
#only ask for a password if no htpasswd exists
test -f /etc/nagios4/htpasswd.users && break
db_input high nagios4/adminpassword || true
db_input high nagios4/adminpassword-repeat || true
db_go || true
db_get nagios4/adminpassword
p1="$RET"
db_get nagios4/adminpassword-repeat
p2="$RET"
if [ "$p1" = "$p2" ]; then
passwordsmatch="yes"
else
db_fset nagios4/adminpassword seen false
db_fset nagios4/adminpassword-repeat seen false
db_fset nagios4/adminpassword-mismatch seen false
db_input critical nagios4/adminpassword-mismatch || true
fi
done
fi
db_go || true