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
30 if [ ! -e /etc/@OLDPACKAGE@/ssl-cert.pem ] || [ ! -e /etc/@OLDPACKAGE@/ssl-cert.key ] ; then
31 # Uh-oh, no SSL cert, let's make sure at least a dummy one exists.
32 if [ ! -e /etc/ssl/certs/ssl-cert-snakeoil.pem ] || [ ! -e /etc/ssl/private/ssl-cert-snakeoil.key ] ; then
33 # What, not even the snakeoil cert is there? Let's generate it
34 make-ssl-cert generate-default-snakeoil
36 # Right. At this point, it should be safe to set the symlinks.
37 ln -s /etc/ssl/certs/ssl-cert-snakeoil.pem /etc/@OLDPACKAGE@/ssl-cert.pem
38 ln -s /etc/ssl/private/ssl-cert-snakeoil.key /etc/@OLDPACKAGE@/ssl-cert.key
41 for i in secrets.inc vhost-list.inc vhost-main.inc vhost-projects.inc ; do
42 if [ ! -e /etc/gforge/httpd.conf.d/$i ] ; then
43 cp /usr/share/gforge/etc/httpd.conf.d-fhs/$i /etc/gforge/httpd.conf.d/$i
44 if [ $i = "secrets.inc" ] ; then
45 chmod 700 /etc/gforge/httpd.conf.d/$i
47 PATH=/usr/share/gforge/bin:$PATH manage-apache-config.sh install
48 mv /etc/gforge/httpd.conf.d/$i.generated /etc/gforge/httpd.conf.d/$i
52 touch /var/lib/gforge/etc/httpd.vhosts
57 chown www-data:www-data /var/lib/@OLDPACKAGE@/download
59 # Enable required modules
60 DEBIAN_FRONTEND=noninteractive a2enmod php5 || true
61 DEBIAN_FRONTEND=noninteractive a2enmod ssl || true
62 DEBIAN_FRONTEND=noninteractive a2enmod env || true
63 DEBIAN_FRONTEND=noninteractive a2enmod vhost_alias || true
64 DEBIAN_FRONTEND=noninteractive a2enmod headers || true
65 DEBIAN_FRONTEND=noninteractive a2enmod rewrite || true
66 DEBIAN_FRONTEND=noninteractive a2enmod proxy || true
67 DEBIAN_FRONTEND=noninteractive a2enmod proxy_http || true
69 # Enable the @FORGENAME@ configuration
70 if [ -e /etc/apache2/conf.d/@OLDPACKAGE@.httpd.conf ] ; then
71 rm -f /etc/apache2/conf.d/@OLDPACKAGE@.httpd.conf
73 if [ -d /etc/apache2/sites-available ] && [ ! -h /etc/apache2/sites-available/@OLDPACKAGE@ ] ; then
74 ln -s /etc/@OLDPACKAGE@/httpd.conf /etc/apache2/sites-available/@OLDPACKAGE@
78 # Make Apache see these new changes
79 invoke-rc.d apache2 restart || true
82 abort-upgrade|abort-remove|abort-deconfigure)
86 echo "postinst called with unknown argument \`$1'" >&2
91 # dh_installdeb will replace this with shell code automatically
92 # generated by other debhelper scripts.