6 . /usr/share/debconf/confmodule
8 # Include CARNet functions.
9 . /usr/share/carnet-tools/functions.sh
11 CONFDIR="/etc/apache2"
12 sitesdir=${CONFDIR}/sites-available
20 # Get CARNet config files in /etc/apache2/sites-available directory.
21 if [ -d "${sitesdir}" ] && [ -n "$(ls ${sitesdir}/)" ]; then
23 for file in ${sitesdir}/*; do
24 if [ -f "$file" ]; then
25 if egrep -q "^## Begin - Generated by CARNet package apache2-cn$" $file; then
26 site=`echo "$file" | sed 's/^\/.*\///'`
27 sitefiles="$sitefiles $site"
34 if [ -n "$sitefiles" ]; then
35 for site in $sitefiles; do
37 if [ -e "$sitesdir/$site" ]; then
39 cp_echo "CN: Removing $site site configuration file."
45 # Remove default DocumentRoot if there's only a one line index.html there
46 docroots="/var/www/$HOST /var/www/www.$DOMAIN"
48 if [ -d "/var/www" ]; then
50 for docroot in $docroots; do
52 if [ -d $docroot ]; then
53 if [ "x$(echo ${docroot}/*)" = "x${docroot}/index.html" ]; then
54 if [ "$(wc -l ${docroot}/index.html | awk '{print $1}')" -eq 1 ]; then
56 cp_echo "CN: Removing document root directory ${docroot}."
57 rm -f $docroot/index.html
58 rmdir $docroot || true
65 # Remove CARNet specific configuration.
66 if [ -d "${CONFDIR}/conf.d" ] && [ -n "$(ls ${CONFDIR}/conf.d/)" ]; then
67 cp_echo "CN: Disabling CARNet specific configuration."
68 for file in ${CONFDIR}/conf.d/*; do
69 if [ -f "$file" ]; then
70 if egrep -q "^## Begin - Generated by CARNet package apache2-cn$" $file; then