This file is indexed.

postinst is in gforge-web-apache2 5.1.1-2.

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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
#! /bin/sh
# postinst script for gforge
#
# see: dh_installdeb(1)

set -e
#set -x				# Be verbose, be very verbose.

# summary of how this script can be called:
#        * <postinst> `configure' <most-recently-configured-version>
#        * <old-postinst> `abort-upgrade' <new version>
#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
#          <new-version>
#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
#          <failed-install-package> <version> `removing'
#          <conflicting-package> <version>
# for details, see /usr/share/doc/packaging-manual/
#
# quoting from the policy:
#     Any necessary prompting should almost always be confined to the
#     post-installation script, and should be protected with a conditional
#     so that unnecessary prompting doesn't happen if a package's
#     installation fails and the `postinst' is called with `abort-upgrade',
#     `abort-remove' or `abort-deconfigure'.

. /usr/share/debconf/confmodule

###
# Functions to handle the main FusionForge configuration file
###
mainconffile=/etc/fusionforge/fusionforge.conf
# Update it for the variables received as parameters
create_mainconffile () {
    if [ ! -e $mainconffile ] ; then
        touch $mainconffile
        chmod 600 $mainconffile
    fi
}
update_mainconffile () {
    for key in $@ ; do
	db_get fusionforge/shared/$key
	val=$RET
	update_onevar_mainconffile $key $val
    done
}
update_onevar_mainconfile () {
    key=$1
    val=$2
    if grep -q "^$key=" $mainconffile ; then
	newval=$(echo $val | sed -e 's/@/\\@/g' -e 's/\$/\\$/g' -e 's/\//\\\//g')
	perl -pi -e "s/^$key=.*/$key=$newval/" $mainconffile
    else
	echo "$key=$val" >> $mainconffile
    fi
}
add_onevar_mainconfile () {
    key=$1
    val=$2
    if ! grep -q "^$key=" $mainconffile ; then
	echo "$key=$val" >> $mainconffile
    fi
}


case "$1" in
    configure)
	if [ -c /dev/urandom ]; then  # ...using /dev/urandom when possible
	    sys_session_key=$(dd if=/dev/urandom count=1 bs=16 2> /dev/null | md5sum | cut -b1-32)
	else			# ...or something else if need be.
	    # Last I was told, the Hurd had no /dev/urandom
	    # (Correct me if it has changed)
	    sys_session_key=$(dd if=/dev/random count=1 bs=8 2> /dev/null | md5sum | cut -b1-32)
	fi
	add_onevar_mainconfile sys_session_key $sys_session_key
	add_onevar_mainconfile sys_show_source 0
	add_onevar_mainconfile sys_force_login 0

	if [ ! -e /etc/gforge/ssl-cert.pem ] || [ ! -e /etc/gforge/ssl-cert.key ] ; then
	    # Uh-oh, no SSL cert, let's make sure at least a dummy one exists.
	    if [ ! -e /etc/ssl/certs/ssl-cert-snakeoil.pem ] || [ ! -e /etc/ssl/private/ssl-cert-snakeoil.key ] ; then
		# What, not even the snakeoil cert is there?  Let's generate it
		make-ssl-cert generate-default-snakeoil
	    fi
	    # Right.  At this point, it should be safe to set the symlinks.
	    ln -s /etc/ssl/certs/ssl-cert-snakeoil.pem /etc/gforge/ssl-cert.pem
	    ln -s /etc/ssl/private/ssl-cert-snakeoil.key /etc/gforge/ssl-cert.key
	fi
	
        fusionforge-config

	for i in secrets.inc vhost-list.inc vhost-main.inc vhost-projects.inc ; do
	    if [ ! -e /etc/gforge/httpd.conf.d/$i ] ; then
		cp /usr/share/gforge/etc/httpd.conf.d-fhs/$i /etc/gforge/httpd.conf.d/$i
		if [ $i = "secrets.inc" ] ; then
		    chmod 700 /etc/gforge/httpd.conf.d/$i
		fi
		PATH=/usr/share/gforge/bin:$PATH manage-apache-config.sh install
		mv /etc/gforge/httpd.conf.d/$i.generated /etc/gforge/httpd.conf.d/$i
	    fi
	done

	touch /var/lib/gforge/etc/httpd.vhosts

	db_stop

        # Setup our FRS
	chown www-data:www-data /var/lib/gforge/download

	# Enable required modules
	DEBIAN_FRONTEND=noninteractive a2enmod php5 || true
	DEBIAN_FRONTEND=noninteractive a2enmod ssl || true
	DEBIAN_FRONTEND=noninteractive a2enmod env || true
	DEBIAN_FRONTEND=noninteractive a2enmod vhost_alias || true
	DEBIAN_FRONTEND=noninteractive a2enmod headers || true
	DEBIAN_FRONTEND=noninteractive a2enmod rewrite || true
	DEBIAN_FRONTEND=noninteractive a2enmod proxy || true
	DEBIAN_FRONTEND=noninteractive a2enmod proxy_http || true
	
	# Enable the FusionForge configuration
	if [ -e /etc/apache2/conf.d/gforge.httpd.conf ] ; then
	    rm -f /etc/apache2/conf.d/gforge.httpd.conf
	fi
	if [ -d /etc/apache2/sites-available ] && [ ! -h /etc/apache2/sites-available/gforge ] ; then
	    ln -s /etc/gforge/httpd.conf /etc/apache2/sites-available/gforge
	fi
	a2ensite gforge
	
	# Make Apache see these new changes
	invoke-rc.d apache2 restart || true
    ;;

    abort-upgrade|abort-remove|abort-deconfigure)
    ;;

    *)
        echo "postinst called with unknown argument \`$1'" >&2
        exit 0
    ;;
esac

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.



exit 0