Commit f4f132d8 authored by Martyn Smith's avatar Martyn Smith Committed by Martyn Smith
Browse files

Added server alias redirection to debian packaging

parent c6fa8560
......@@ -16,5 +16,7 @@ db_input $PRIORITY mahara/db_user || true
db_go
db_input $PRIORITY mahara/servername || true
db_go
db_input $PRIORITY mahara/serverredirects || true
db_go
db_input $PRIORITY mahara/smtphosts || true
db_go
......@@ -22,6 +22,7 @@ set -e
. /usr/share/debconf/confmodule
TMP_M4_FILE=/tmp/mahara.postinst.m4.tmp
APACHE_CONF_FILE=/etc/apache/conf.d/100-mahara.conf
case "$1" in
configure)
......@@ -56,9 +57,20 @@ case "$1" in
db_get mahara/servername
echo "define(__SERVERNAME__,${RET})dnl" >> $TMP_M4_FILE
echo "define(__APACHELOGDIR__,/var/log/apache)dnl" >> $TMP_M4_FILE
m4 $TMP_M4_FILE /usr/share/mahara/apache.conf.template > /etc/apache/conf.d/100-mahara
m4 $TMP_M4_FILE /usr/share/mahara/apache.conf.template > $APACHE_CONF_FILE
rm -f $TMP_M4_FILE
db_get mahara/serverredirects
if [ -n "${RET}" ]; then
echo '<VirtualHost *>' >> $APACHE_CONF_FILE
echo ${RET} | perl -ne '@s = split /\s*,\s*/; print " ServerName ", shift @s, "\n" if @s; print map { " ServerAlias $_\n" } @s;' >> $APACHE_CONF_FILE
db_get mahara/servername
echo " Redirect Permanent / http://${RET}"
echo '</VirtualHost>' >> $APACHE_CONF_FILE
fi
restart_apache;
db_get mahara/servername
echo ""
......
......@@ -33,6 +33,16 @@ Description: Server name:
Note that this is just the domain name, so for "http://my.site.com" you only
need to enter "my.site.com"
Template: mahara/serverredirects
Type: string
Default:
Description: Server redirects:
Comma separated list of domain names that the server should permanently
redirect to the server name.
.
Note that this is just the domain name, so for "http://my.site.com" you only
need to enter "my.site.com"
Template: mahara/smtphosts
Type: string
Default:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment