#!/bin/bash -e . /usr/share/debconf/confmodule db_version 2.0 db_capb backup db_title Apache 2.2 mod-mono tempfile=`/bin/tempfile` # Figure out which module we want to connect to USE_MONO_SERVER=none if [ -x /usr/bin/mod-mono-server2 ]; then USE_MONO_SERVER=mod-mono-server2 fi if [ -x /usr/bin/mod-mono-server4 ]; then if [ -x /usr/bin/mod-mono-server2 ]; then USE_MONO_SERVER=ask else USE_MONO_SERVER=mod-mono-server4 fi fi # See if we need to ask questions if [ "x$USE_MONO_SERVER" = "xask" ]; then # Loop until we get a proper response STATE=1 while [ "$STATE" != 0 -a "$STATE" != 2 ]; do case "$STATE" in 1) db_input medium libapache2-mod-mono/mono-server || true if db_go; then db_get libapache2-mod-mono/mono-server || true USE_MONO_SERVER=$RET STATE=2 else STATE=0 fi ;; esac done if [ "$STATE" = 0 ]; then exit 1 fi fi # Change the includes as appropriate MONO_CONF=/etc/apache2/mods-available/mod_mono.conf # Exit without an error if the user has deleted their config for some reason # We can't merely create a new config here, as it breaks conffile tracking if [ ! -e "$MONO_CONF" ]; then exit 0 fi case "$USE_MONO_SERVER" in none) # Can't find anything echo "Either mono-apache-server2 or mono-apache-server4 needs " echo "to be installed." exit 1 ;; mod-mono-server2) echo "Using mono-apache-server2..." sed 's@^Include.*$@Include /etc/mono-server2/mono-server2-hosts.conf@' \ < $MONO_CONF > $tempfile cp -f $tempfile $MONO_CONF rm -f $tempfile ;; mod-mono-server4) echo "Using mono-apache-server4..." sed 's@^Include.*$@Include /etc/mono-server4/mono-server4-hosts.conf@'\ < $MONO_CONF > $tempfile cp -f $tempfile $MONO_CONF rm -f $tempfile ;; esac