2 # postinst script for @OLDPACKAGE@
4 # see: dh_installdeb(1)
7 #set -x # Be verbose, be very verbose.
9 # summary of how this script can be called:
10 # * <postinst> `configure' <most-recently-configured-version>
11 # * <old-postinst> `abort-upgrade' <new version>
12 # * <conflictor's-postinst> `abort-remove' `in-favour' <package>
14 # * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
15 # <failed-install-package> <version> `removing'
16 # <conflicting-package> <version>
17 # for details, see /usr/share/doc/packaging-manual/
19 # quoting from the policy:
20 # Any necessary prompting should almost always be confined to the
21 # post-installation script, and should be protected with a conditional
22 # so that unnecessary prompting doesn't happen if a package's
23 # installation fails and the `postinst' is called with `abort-upgrade',
24 # `abort-remove' or `abort-deconfigure'.
26 . /usr/share/debconf/confmodule
28 #DSFHELPER:handle-mainconffile#
32 if [ -c /dev/urandom ]; then # ...using /dev/urandom when possible
33 sys_session_key=$(dd if=/dev/urandom count=256 bs=1 2> /dev/null | md5sum | cut -b1-32)
34 else # ...or something else if need be.
35 # Last I was told, the Hurd had no /dev/urandom
36 # (Correct me if it has changed)
37 sys_session_key=$(dd if=/dev/random count=256 bs=1 2> /dev/null | md5sum | cut -b1-32)
39 add_onevar_mainconfile sys_session_key $sys_session_key
40 add_onevar_mainconfile sys_show_source 0
41 add_onevar_mainconfile sys_force_login 0
43 if [ ! -e /etc/@OLDPACKAGE@/ssl-cert.pem ] || [ ! -e /etc/@OLDPACKAGE@/ssl-cert.key ] ; then
44 # Uh-oh, no SSL cert, let's make sure at least a dummy one exists.
45 if [ ! -e /etc/ssl/certs/ssl-cert-snakeoil.pem ] || [ ! -e /etc/ssl/private/ssl-cert-snakeoil.key ] ; then
46 # What, not even the snakeoil cert is there? Let's generate it
47 make-ssl-cert generate-default-snakeoil
49 # Right. At this point, it should be safe to set the symlinks.
50 ln -s /etc/ssl/certs/ssl-cert-snakeoil.pem /etc/@OLDPACKAGE@/ssl-cert.pem
51 ln -s /etc/ssl/private/ssl-cert-snakeoil.key /etc/@OLDPACKAGE@/ssl-cert.key
56 for i in secrets.inc vhost-list.inc vhost-main.inc vhost-projects.inc ; do
57 if [ ! -e /etc/gforge/httpd.conf.d/$i ] ; then
58 cp /usr/share/gforge/etc/httpd.conf.d-fhs/$i /etc/gforge/httpd.conf.d/$i
59 if [ $i = "secrets.inc" ] ; then
60 chmod 700 /etc/gforge/httpd.conf.d/$i
62 PATH=/usr/share/gforge/bin:$PATH manage-apache-config.sh install
63 mv /etc/gforge/httpd.conf.d/$i.generated /etc/gforge/httpd.conf.d/$i
67 touch /var/lib/gforge/etc/httpd.vhosts
72 chown www-data:www-data /var/lib/@OLDPACKAGE@/download
74 # Enable required modules
75 DEBIAN_FRONTEND=noninteractive a2enmod php5 || true
76 DEBIAN_FRONTEND=noninteractive a2enmod ssl || true
77 DEBIAN_FRONTEND=noninteractive a2enmod env || true
78 DEBIAN_FRONTEND=noninteractive a2enmod vhost_alias || true
79 DEBIAN_FRONTEND=noninteractive a2enmod headers || true
80 DEBIAN_FRONTEND=noninteractive a2enmod rewrite || true
81 DEBIAN_FRONTEND=noninteractive a2enmod proxy || true
82 DEBIAN_FRONTEND=noninteractive a2enmod proxy_http || true
84 # Enable the @FORGENAME@ configuration
85 if [ -e /etc/apache2/conf.d/@OLDPACKAGE@.httpd.conf ] ; then
86 rm -f /etc/apache2/conf.d/@OLDPACKAGE@.httpd.conf
88 if [ -d /etc/apache2/sites-available ] && [ ! -e /etc/apache2/sites-available/@OLDPACKAGE@ ] ; then
89 ln -s /etc/@OLDPACKAGE@/httpd.conf /etc/apache2/sites-available/@OLDPACKAGE@
93 # Make Apache see these new changes
94 invoke-rc.d apache2 restart || true
97 abort-upgrade|abort-remove|abort-deconfigure)
101 echo "postinst called with unknown argument \`$1'" >&2
106 # dh_installdeb will replace this with shell code automatically
107 # generated by other debhelper scripts.