This file is indexed.

postinst is in mono-xsp2 2.10-1build1.

This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
#!/bin/bash
set -e

. /usr/share/debconf/confmodule
db_version 2.0

xsp2_default="/etc/default/mono-xsp2"
NAME=mono-xsp2
DESC="XSP 2 WebServer"
CFGDIR=/etc/xsp2
VIRTUALFILE=$CFGDIR/debian.webapp

update_port() {
    db_get xsp2/xsp2_port || true
    R=$RET
    echo "Using Mono XSP 2 port: $R"
    sed "s/port=.*/port=$R/g" $xsp2_default > $tempfile
    cp -f $tempfile $xsp2_default
}

update_bind() {
    db_get xsp2/xsp2_bind || true
    R=$RET
    echo "Binding Mono XSP 2 address: $R"
    sed "s/address=.*/address=$R/g" $xsp2_default > $tempfile
    cp -f $tempfile $xsp2_default
}

should_start() {
    if [ -e $xsp2_default ]; then
	. $xsp2_default
        if [ "$start_boot" != "true" ]; then
	    return 1
        fi
    else
        echo "mono-xsp2: Not started, you need a valid and complete $xsp2_default"
        return 1
    fi

    if [ ! -e $VIRTUALFILE -o `cat $VIRTUALFILE | wc -l` = "2" ]; then
	echo "mono-xsp2: Not started, you need asp.net-examples/monodoc-http or an ASP.NET application"
	return 1
    fi 
    
    if [ -f /var/run/$NAME.pid ]; then
	# Are we really running xsp2?
	xsp2_pid=`cat /var/run/$NAME.pid`
	xsp2_ps=`ps -p $xsp2_pid | wc -l`
	if [ "$xsp2_ps" != "2" ]; then
	    return 0
	else
	    return 1
	fi
    else
	return 1
    fi
    
    return 1
}

case "$1" in
    configure)
	tempfile=$(/bin/tempfile)
	
	# Configure autostart, but don't prevent the init script
	# from starting it manually.
	autostart="true"
	db_get xsp2/xsp2_autostart || true
	if [ "$RET" = "true" ]; then	    
	    if [ -x "/etc/init.d/mono-xsp2" ]; then
		update-rc.d mono-xsp2 defaults > /dev/null 2>&1 || true
	    fi
	else
	    update-rc.d -f mono-xsp2 remove > /dev/null 2>&1  || true
	fi

	# If default file exists, configure the port and address
	if [ -f $xsp2_default ]; then
	    update_port
	    update_bind
	fi

	mono-xsp2-update
	if [ "$RET" = "true" ]; then
	    if should_start -a $autostart = "true" ; then
		if which invoke-rc.d >/dev/null 2>&1; then
		    invoke-rc.d mono-xsp2 start
		else
		    /etc/init.d/mono-xsp2 start
		fi
	    fi
	fi

	rm $tempfile
	;;
esac

# Automatically added by dh_installinit
if [ -x "/etc/init.d/mono-xsp2" ]; then
	if [ ! -e "/etc/init/mono-xsp2.conf" ]; then
		update-rc.d mono-xsp2 defaults >/dev/null
	fi
	invoke-rc.d mono-xsp2 start || exit $?
fi
# End automatically added section


exit 0