Prva inacica paketa za Debian squeeze distribuciju.
authorDragan Dosen <ddosen@ffzg.hr>
Fri, 29 Apr 2011 16:22:21 +0000 (18:22 +0200)
committerDragan Dosen <ddosen@ffzg.hr>
Fri, 29 Apr 2011 16:22:21 +0000 (18:22 +0200)
16 files changed:
README.CARNet [moved from debian/README.CARNet with 85% similarity]
debian/changelog
debian/changelog.CARNet [deleted symlink]
debian/compat
debian/config
debian/control
debian/copyright [new file with mode: 0644]
debian/docs
debian/lintian-overrides [new file with mode: 0644]
debian/po/POTFILES.in [new file with mode: 0644]
debian/po/templates.pot [new file with mode: 0644]
debian/postinst
debian/postrm
debian/prerm
debian/rules
debian/templates

similarity index 85%
rename from debian/README.CARNet
rename to README.CARNet
index 7364c3b..2f22129 100644 (file)
@@ -1,8 +1,8 @@
 apache2-cn
-----------
+~~~~~~~~~~
 
 Ovaj paket donosi CARNetovu dodatnu konfiguraciju za apache2 paket
-iz Debian lenny distribucije.
+iz Debian squeeze distribucije.
 
 Paket dodaje VirtualHost zapise za slijedece webove:
 
@@ -31,4 +31,4 @@ Apache2 moduli koji su automatski ukljuceni:
   * CGI
 
 
- -- Dragan Dosen <ddosen@ffzg.hr>  Sun, 19 Apr 2009 19:13:48 +0200
+ -- Dragan Dosen <ddosen@ffzg.hr>  Fri, 29 Apr 2011 16:49:58 +0200
index fc63258..1955049 100644 (file)
@@ -1,3 +1,14 @@
+apache2-cn (2.2+1) stable; urgency=low
+
+  * Prva inacica paketa za Debian squeeze distribuciju.
+  * Nova debian/rules datoteka.
+  * Azurirane ovisnosti unutar debian/control.
+  * Razni Lintian popravci, dodan copyright, promjena inacice
+    paketa u Debian native.
+  * Azurirana datoteka README.CARNet.
+
+ -- Dragan Dosen <ddosen@ffzg.hr>  Fri, 29 Apr 2011 16:49:58 +0200
+
 apache2-cn (2.2-5lenny1) stable; urgency=low
 
   * Upgrade paketa za Debian lenny.
diff --git a/debian/changelog.CARNet b/debian/changelog.CARNet
deleted file mode 120000 (symlink)
index 194579e..0000000
+++ /dev/null
@@ -1 +0,0 @@
-changelog.Debian
\ No newline at end of file
index b8626c4..7f8f011 100644 (file)
@@ -1 +1 @@
-4
+7
index d41c159..d2ae8b4 100755 (executable)
@@ -11,7 +11,7 @@ if [ "$1" != reconfigure ]; then
 
     db_fget apache2-cn/wwwhost seen
     if [ "$RET" != "true" ]; then
-       apache2_done=0
+        apache2_done=0
     fi
 
     test $apache2_done -eq 1 && exit 0
@@ -29,18 +29,18 @@ DOMAIN=$(hostname -d)
 has_listen_ssl=0
 
 if [ -d "$CONFDIR/conf.d" ] && [ -n "$(ls $CONFDIR/conf.d)" ]; then
-        listen_ssl_mask=$CONFDIR/conf.d/*
+    listen_ssl_mask=$CONFDIR/conf.d/*
 fi
 if [ -d "$CONFDIR/sites-enabled" ] && [ -n "$(ls $CONFDIR/sites-enabled)" ]; then
-        listen_ssl_mask=$listen_ssl_mask" "$CONFDIR/sites-enabled/*
+    listen_ssl_mask=$listen_ssl_mask" "$CONFDIR/sites-enabled/*
 fi
 
 for file in $CONF $listen_ssl_mask; do
     if [ -f "$file" ]; then
         if egrep -iq '^[[:space:]]*<VirtualHost .*443[[:space:]]*>' $file; then
-           has_listen_ssl=1
-           break
-       fi
+            has_listen_ssl=1
+            break
+        fi
     fi
 done
 
@@ -49,80 +49,80 @@ done
 #
 if [ $has_listen_ssl -eq 1 ]; then
 
-       # SSL configuration already exists - no need for SSL certificates.    
-       db_set apache2-cn/sslcf "" || true
-       db_set apache2-cn/sslckf "" || true
-       db_set apache2-cn/sslccf "" || true
+    # SSL configuration already exists - no need for SSL certificates.
+    db_set apache2-cn/sslcf "" || true
+    db_set apache2-cn/sslckf "" || true
+    db_set apache2-cn/sslccf "" || true
 
 else
 
-       # SSL certificates information..
-       SSLCF=1
-       while [ $SSLCF -eq 1 ]; do
-
-           # SSL certificate file input.
-           db_input critical apache2-cn/sslcf || true
-           db_go || true
-           
-           db_get apache2-cn/sslcf || true
-           
-           if [ -n "$RET" ]; then
-
-               if [ -f "$RET" ]; then
-               
-                   # SSL certificate file exists.
-                   SSLCF=0
-                   
-                   SSLCKF=1
-                   while [ $SSLCKF -eq 1 ]; do
-                   
-                       # SSL certificate key file input.
-                       db_input critical apache2-cn/sslckf || true
-                       db_go || true
-               
-                       db_get apache2-cn/sslckf || true
-               
-                       if [ -n "$RET" ]; then
-                       
-                           if [ -f "$RET" ]; then
-                       
-                               # SSL certificate key file exists.    
-                               SSLCKF=0
-                               
-                               SSLCCF=1
-                               while [ $SSLCCF -eq 1 ]; do
-                               
-                                   # SSL certificate chain file input.
-                                   db_input critical apache2-cn/sslccf || true
-                                   db_go || true
-                                   
-                                   db_get apache2-cn/sslccf || true
-                                   
-                                   if [ -n "$RET" ]; then
-                                           
-                                       if [ -f "$RET" ]; then
-                                       
-                                           # SSL certificate chain file exists.
-                                           SSLCCF=0
-                                       fi
-                                   else
-                                       SSLCCF=0
-                                   fi
-                               done
-                           fi
-                       fi
-                   done
-               fi
-           else
-           
-               # No SSL certificates specified.
-               db_set apache2-cn/sslcf "" || true
-               db_set apache2-cn/sslckf "" || true
-               db_set apache2-cn/sslccf "" || true
-               
-               SSLCF=0
-           fi
-       done
+    # SSL certificates information..
+    SSLCF=1
+    while [ $SSLCF -eq 1 ]; do
+
+        # SSL certificate file input.
+        db_input critical apache2-cn/sslcf || true
+        db_go || true
+
+        db_get apache2-cn/sslcf || true
+
+        if [ -n "$RET" ]; then
+
+            if [ -f "$RET" ]; then
+
+                # SSL certificate file exists.
+                SSLCF=0
+
+                SSLCKF=1
+                while [ $SSLCKF -eq 1 ]; do
+
+                    # SSL certificate key file input.
+                    db_input critical apache2-cn/sslckf || true
+                    db_go || true
+
+                    db_get apache2-cn/sslckf || true
+
+                    if [ -n "$RET" ]; then
+
+                        if [ -f "$RET" ]; then
+
+                            # SSL certificate key file exists.
+                            SSLCKF=0
+
+                            SSLCCF=1
+                            while [ $SSLCCF -eq 1 ]; do
+
+                                # SSL certificate chain file input.
+                                db_input critical apache2-cn/sslccf || true
+                                db_go || true
+
+                                db_get apache2-cn/sslccf || true
+
+                                if [ -n "$RET" ]; then
+
+                                    if [ -f "$RET" ]; then
+
+                                        # SSL certificate chain file exists.
+                                        SSLCCF=0
+                                    fi
+                                else
+                                    SSLCCF=0
+                                fi
+                            done
+                        fi
+                    fi
+                done
+            fi
+        else
+
+            # No SSL certificates specified.
+            db_set apache2-cn/sslcf "" || true
+            db_set apache2-cn/sslckf "" || true
+            db_set apache2-cn/sslccf "" || true
+
+            SSLCF=0
+        fi
+    done
 fi
 
 
@@ -130,10 +130,10 @@ fi
 # - only during fresh install
 #
 if [ -z "$2" ]; then
-       db_subst apache2-cn/wwwhost stroj_domena "${HOST}.${DOMAIN}"
-       db_subst apache2-cn/wwwhost www_domena "www.${DOMAIN}"
-       db_input critical apache2-cn/wwwhost || true
-       db_go || true
+    db_subst apache2-cn/wwwhost stroj_domena "${HOST}.${DOMAIN}"
+    db_subst apache2-cn/wwwhost www_domena "www.${DOMAIN}"
+    db_input critical apache2-cn/wwwhost || true
+    db_go || true
 fi
 
 exit 0
index f8a1f0b..4be6f51 100644 (file)
@@ -1,15 +1,15 @@
 Source: apache2-cn
-Section: web
+Section: httpd
 Priority: optional
 Maintainer: Dragan Dosen <ddosen@ffzg.hr>
-Build-Depends: debhelper (>= 4.0.0)
-Standards-Version: 3.7.2
+Build-Depends: debhelper (>= 7), po-debconf
+Standards-Version: 3.9.1
 
 Package: apache2-cn
 Architecture: all
-Depends: apache2-mpm-prefork (>= 2.2.9-10+lenny2), apache2 (>= 2.2.9-10+lenny2), apache2-suexec (>= 2.2.9-10+lenny2), apache2 (<< 2.3), php5-cn (>= 5.2.6-1), carnet-tools-cn (>= 2.8.1), ${perl:Depends}, ssl-cert, procps, debconf (>= 0.5) | debconf-2.0, postfix | mail-transport-agent
+Depends: apache2-mpm-prefork (>= 2.2.16-6+squeeze1), apache2 (>= 2.2.16-6+squeeze1), apache2-suexec (>= 2.2.16-6+squeeze1), apache2 (<< 2.3), php5-cn (>= 5.3.3+1), carnet-tools-cn (>= 3.0.0), ssl-cert, procps, debconf (>= 0.5) | debconf-2.0, postfix | mail-transport-agent, ${misc:Depends}
 Suggests: mod-security-cn, apache2-doc, ca-certificates, monit-cn
-Description: Apache HTTP Server - traditional non-threaded model (CARNet configuration)
+Description: Apache HTTP Server - traditional non-threaded model
  Each Apache Multi-Processing Module provides a different "flavor" of
  web server binary, compiled with a different processing model.
  .
@@ -21,7 +21,6 @@ Description: Apache HTTP Server - traditional non-threaded model (CARNet configu
  request, so that a problem with a single request will not affect any
  other.
  .
- Homepage: http://httpd.apache.org/
- .
  This dummy package provided by CARNet configures a simple https enabled
  web service with PHP5.
+Homepage: http://httpd.apache.org/
diff --git a/debian/copyright b/debian/copyright
new file mode 100644 (file)
index 0000000..5350ae7
--- /dev/null
@@ -0,0 +1,7 @@
+Copyright 2011 CARNet 
+
+You are free to distribute this software package under the terms of the
+GNU General Public License.
+
+On Debian systems, the complete text of the GNU General Public
+License can be found in the file /usr/share/common-licenses/GPL.
index b5a8299..8f6e250 100644 (file)
@@ -1,2 +1 @@
-debian/changelog.CARNet
-debian/README.CARNet
+README.CARNet
diff --git a/debian/lintian-overrides b/debian/lintian-overrides
new file mode 100644 (file)
index 0000000..849d21f
--- /dev/null
@@ -0,0 +1 @@
+apache2-cn: latest-debian-changelog-entry-changed-to-native
diff --git a/debian/po/POTFILES.in b/debian/po/POTFILES.in
new file mode 100644 (file)
index 0000000..cef83a3
--- /dev/null
@@ -0,0 +1 @@
+[type: gettext/rfc822deb] templates
diff --git a/debian/po/templates.pot b/debian/po/templates.pot
new file mode 100644 (file)
index 0000000..db7803c
--- /dev/null
@@ -0,0 +1,113 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: apache2-cn@packages.debian.org\n"
+"POT-Creation-Date: 2011-04-29 18:17+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#. Type: string
+#. Description
+#: ../templates:1001
+msgid "SSL Certificate:"
+msgstr ""
+
+#. Type: string
+#. Description
+#: ../templates:1001
+msgid ""
+"Upisite lokaciju vec postojeceg SSL certifikata. U slucaju da nemate SSL "
+"certifikate, ostavite ovo polje praznim - ne morate nista upisivati. "
+"Instalacija ce automatski generirati SSL certifikat i obaviti konfiguraciju "
+"Vaseg Apache2 web servera."
+msgstr ""
+
+#. Type: string
+#. Description
+#: ../templates:1001
+msgid "Primjer: /etc/ssl/certs/apache2.pem"
+msgstr ""
+
+#. Type: string
+#. Description
+#: ../templates:2001
+msgid "SSL Certificate Key:"
+msgstr ""
+
+#. Type: string
+#. Description
+#: ../templates:2001
+msgid "Upisite lokaciju vec postojece datoteke koja sadrzi SSL kljuc."
+msgstr ""
+
+#. Type: string
+#. Description
+#: ../templates:2001
+msgid "Primjer: /etc/ssl/private/apache2.key"
+msgstr ""
+
+#. Type: string
+#. Description
+#: ../templates:3001
+msgid "SSL Certificate Chain:"
+msgstr ""
+
+#. Type: string
+#. Description
+#: ../templates:3001
+msgid ""
+"Upisite lokaciju vec postojece SSL chain datoteke. U slucaju da nemate SSL "
+"chain datoteku, ostavite ovo polje praznim."
+msgstr ""
+
+#. Type: string
+#. Description
+#: ../templates:3001
+msgid "Primjer: /etc/ssl/certs/sureserverEDU.pem"
+msgstr ""
+
+#. Type: boolean
+#. Description
+#: ../templates:4001
+msgid "Dodati WWW VirtualHost u konfiguraciju web servera?"
+msgstr ""
+
+#. Type: boolean
+#. Description
+#: ../templates:4001
+msgid ""
+"Apache2 web server moze posluzivati web stranice s adresom oblika "
+"${www_domena}. U slucaju DA to zelite, Apache2 web server ce posluzivati web "
+"stranice na adresama:"
+msgstr ""
+
+#. Type: boolean
+#. Description
+#: ../templates:4001
+msgid ""
+"http://${stroj_domena}/, https://${www_domena}, te https://${www_domena} "
+"(SSL)."
+msgstr ""
+
+#. Type: boolean
+#. Description
+#: ../templates:4001
+msgid "Ako to NE zelite, Apache2 server ce posluzivati stranice na adresama:"
+msgstr ""
+
+#. Type: boolean
+#. Description
+#: ../templates:4001
+msgid "http://${stroj_domena} i https://${stroj_domena}."
+msgstr ""
index 41a96aa..907be26 100755 (executable)
@@ -8,18 +8,18 @@ set -e
 . /usr/share/debconf/confmodule
 
 case "$1" in
-       configure)
-               # continue below
-               ;;
-
-       abort-upgrade|abort-remove|abort-deconfigure)
-               exit 0
-               ;;
-
-       *)
-               echo "postinst called with unknown argument \`$1'" >&2
-               exit 0
-               ;;
+    configure)
+        # continue below
+        ;;
+
+    abort-upgrade|abort-remove|abort-deconfigure)
+        exit 0
+        ;;
+
+    *)
+        echo "postinst called with unknown argument \`$1'" >&2
+        exit 0
+        ;;
 esac
 
 
@@ -27,7 +27,7 @@ esac
 . /usr/share/carnet-tools/functions.sh
 
 PKG="apache2-cn"
-VERSION="2.2-5lenny1"
+VERSION="2.2+1"
 CONFDIR="/etc/apache2"
 CONF="$CONFDIR/apache2.conf"
 A2MODEDIR="$CONFDIR/mods-enabled"
@@ -60,14 +60,13 @@ listen_ssl_mask=
 #   Cleanup all temp files.
 #
 cleanup () {
-
-       if [ -n "$temp_files" ]; then
-               for item in $temp_files; do
-                       if [ -e "$item" ]; then
-                               rm -f $item
-                       fi
-               done
-       fi
+    if [ -n "$temp_files" ]; then
+        for item in $temp_files; do
+            if [ -e "$item" ]; then
+                rm -f $item
+            fi
+        done
+    fi
 }
 
 # tag_conf()
@@ -75,13 +74,11 @@ cleanup () {
 #   Add CARNet package info lines to config's header.
 #
 tag_conf () {
-       
-       local conf_file
-       conf_file="$1"
-       
-       if [ -e "$conf_file" ]; then
-       
-               cat >> $conf_file <<EOF
+    local conf_file
+    conf_file="$1"
+
+    if [ -e "$conf_file" ]; then
+        cat >> $conf_file <<EOF
 ## Begin - Generated by CARNet package apache2-cn
 #
 #  REMOVE this whole block if you DON'T WANT apache2-cn
@@ -89,7 +86,7 @@ tag_conf () {
 #
 ## End - Generated by CARNet package apache2-cn
 EOF
-       fi
+    fi
 }
 
 # chk_conf_tag ()
@@ -100,18 +97,17 @@ EOF
 #                    2 - file exists, but it is not tagged
 #
 chk_conf_tag () {
-
-       local conf_file
-       conf_file="$1"
-       RET=1
-       
-       if [ -f "$conf_file" ]; then
-               if egrep -q "^## Begin - Generated by CARNet package apache2-cn$" "$conf_file"; then
-                       RET=0
-               else
-                       RET=2
-               fi
-       fi
+    local conf_file
+    conf_file="$1"
+    RET=1
+
+    if [ -f "$conf_file" ]; then
+        if egrep -q "^## Begin - Generated by CARNet package apache2-cn$" "$conf_file"; then
+            RET=0
+        else
+            RET=2
+        fi
+    fi
 }
 
 # generate_ssl()
@@ -119,10 +115,9 @@ chk_conf_tag () {
 #   Generate Apache2 web server SSL certificate.
 #
 generate_ssl () {
-
-       generate_ssl_output=$($A2CNDIR/carnet-generate-ssl ignore "$FQDN" "$WEBMASTER" "$DOMAIN" 2> /dev/null)
-       cp_echo "$generate_ssl_output"
-       need_restart=1
+    generate_ssl_output=$($A2CNDIR/carnet-generate-ssl ignore "$FQDN" "$WEBMASTER" "$DOMAIN" 2> /dev/null)
+    cp_echo "$generate_ssl_output"
+    need_restart=1
 }
 
 # listen_ssl()
@@ -131,23 +126,23 @@ generate_ssl () {
 #
 listen_ssl() {
 
-       if [ ! -f "$PORTCONF" ] || ! egrep -iq "^[[:space:]]*Listen[[:space:]]+443$" "$PORTCONF"; then
-       
-               cp_echo "CN: Enabling SSL port (443) for Apache2 web server."
-
-               out=$(mktemp ${PORTCONF}.XXXXXX)
-               
-               if [ -f "$PORTCONF" ]; then
-                       cp $PORTCONF $out
-               fi
-               
-               echo "Listen 443" >> $out
-               cp_mv $out $PORTCONF
-               chmod 644 $PORTCONF
-               
-               need_restart=1
-               temp_files="${temp_files} ${out}"
-       fi
+    if [ ! -f "$PORTCONF" ] || ! egrep -iq "^[[:space:]]*Listen[[:space:]]+443$" "$PORTCONF"; then
+
+        cp_echo "CN: Enabling SSL port (443) for Apache2 web server."
+
+        out=$(mktemp ${PORTCONF}.XXXXXX)
+
+        if [ -f "$PORTCONF" ]; then
+            cp $PORTCONF $out
+        fi
+
+        echo "Listen 443" >> $out
+        cp_mv $out $PORTCONF
+        chmod 644 $PORTCONF
+
+        need_restart=1
+        temp_files="${temp_files} ${out}"
+    fi
 }
 
 # install_conf()
@@ -155,19 +150,18 @@ listen_ssl() {
 #   Install specified Apache2 configuration file.
 #
 install_conf() {
+    conftmpl="$A2CNDIR/$1.conf"
+    conf="$CONFDIR/conf.d/$2.conf"
 
-       conftmpl="$A2CNDIR/$1.conf"
-       conf="$CONFDIR/conf.d/$2.conf"
-
-       if [ ! -e "$conf" ]; then
-       
-               cp_echo "CN: Enabling CARNet specific configuration."
-               cp "$conftmpl" "$conf"
-               
-               need_restart=1
-       else
-               cp_echo "CN: $conf already exists, left untouched." 1>&2
-       fi
+    if [ ! -e "$conf" ]; then
+
+        cp_echo "CN: Enabling CARNet specific configuration."
+        cp "$conftmpl" "$conf"
+
+        need_restart=1
+    else
+        cp_echo "CN: $conf already exists, left untouched." 1>&2
+    fi
 }
 
 # install_vhost()
@@ -188,99 +182,98 @@ install_conf() {
 #   site-enabled-symlink - name of symlink in sites-enabled
 #
 install_vhost() {
+    add_namevirthost=
+    mkdir_docroot=
+    symlink_docroot=
+    docroot=
+    vhostname=
+
+    while echo "x$1" | grep -q '^x-'; do
+        case "$1" in
+            -nvh)
+                add_namevirthost=1
+                shift
+                ;;
+            -d)
+                mkdir_docroot=1
+                shift
+                ;;
+            -s)
+                shift
+                symlink_docroot="$1"
+                shift
+                ;;
+            -r)
+                shift
+                docroot="$1"
+                if ! echo "$docroot" | grep -q /; then
+                    docroot="/var/www/$docroot"
+                fi
+                shift
+                ;;
+            -n)
+                shift
+                vhostname="$1"
+                shift
+                ;;
+        esac
+    done
+
+    vhosttmpl="$1.template"
+    vhost="$2"
+    venabled="$3"
+    [ -z "$vhostname" ] && vhostname=$(echo "$vhost"| awk -F. '{print $1}')
+    force_vhost=
+
+    vhostdir=$CONFDIR/sites-available
+    venabledir=$CONFDIR/sites-enabled
+
+    if [ ! -e "$TMPLDIR/${vhosttmpl}" ]; then
+        echo "E: vhost template ${vhosttmpl} not found in $TMPLDIR!" 1>&2
+        exit 2
+    fi
+
+    [ -z "$docroot" ] && docroot="/var/www/$vhostname.$DOMAIN"
+
+    # if we were broken mid-installation, force
+    if [ ! -e "$docroot" -a \( -n "$mkdir_docroot" -o -n "$symlink_docroot" \) ]; then
+        force_vhost=1
+    fi
+
+    # add vhost if either of these is true
+    # - adding is forced OR
+    # - it doesn't exist
+    #
+    if [ -n "$force_vhost" -o \( ! -e "$vhostdir/$vhost" -a ! -e "$venabledir/$venabled" \) ]; then
+
+        cp_echo "CN: Adding $vhost VirtualHost."
+        out=$(mktemp $vhostdir/$vhost.XXXXXX)
+        temp_files="${temp_files} ${out}"
+
+        # CARNet header.
+        tag_conf "$out"
+
+        if [ "$add_namevirthost" ]; then
+            nvh=$(awk -F'[ >]' '/^<VirtualHost/ {print $2}' $TMPLDIR/$vhosttmpl |\
+                sed "s/IPADDR/$MYIP/g")
+            echo "NameVirtualHost $nvh" >> $out
+        fi
 
-       add_namevirthost=
-       mkdir_docroot=
-       symlink_docroot=
-       docroot=
-       vhostname=
-  
-       while echo "x$1" | grep -q '^x-'; do
-           case "$1" in
-               -nvh)
-                   add_namevirthost=1
-                   shift
-                   ;;
-               -d)
-                   mkdir_docroot=1
-                   shift
-                   ;;
-               -s)
-                   shift
-                   symlink_docroot="$1"
-                   shift
-                   ;;
-               -r)
-                   shift
-                   docroot="$1"
-                   if ! echo "$docroot" | grep -q /; then
-                           docroot="/var/www/$docroot"
-                   fi
-                   shift
-                   ;;
-               -n)
-                   shift
-                   vhostname="$1"
-                   shift
-                   ;;
-           esac
-       done
-
-       vhosttmpl="$1.template"
-       vhost="$2"
-       venabled="$3"
-       [ -z "$vhostname" ] && vhostname=$(echo "$vhost"| awk -F. '{print $1}')
-       force_vhost=
-
-       vhostdir=$CONFDIR/sites-available
-       venabledir=$CONFDIR/sites-enabled
-
-       if [ ! -e "$TMPLDIR/${vhosttmpl}" ]; then
-               echo "E: vhost template ${vhosttmpl} not found in $TMPLDIR!" 1>&2
-               exit 2
-       fi
-
-       [ -z "$docroot" ] && docroot="/var/www/$vhostname.$DOMAIN"
-  
-       # if we were broken mid-installation, force
-       if [ ! -e "$docroot" -a \( -n "$mkdir_docroot" -o -n "$symlink_docroot" \) ]; then
-               force_vhost=1
-       fi
-  
-       # add vhost if either of these is true
-       # - adding is forced OR
-       # - it doesn't exist
-       #
-       if [ -n "$force_vhost" -o \( ! -e "$vhostdir/$vhost" -a ! -e "$venabledir/$venabled" \) ]; then
-       
-               cp_echo "CN: Adding $vhost VirtualHost."
-               out=$(mktemp $vhostdir/$vhost.XXXXXX)
-               temp_files="${temp_files} ${out}"
-               
-               # CARNet header.
-               tag_conf "$out"
-
-               if [ "$add_namevirthost" ]; then
-                       nvh=$(awk -F'[ >]' '/^<VirtualHost/ {print $2}' $TMPLDIR/$vhosttmpl |\
-                           sed "s/IPADDR/$MYIP/g")
-                       echo "NameVirtualHost $nvh" >> $out
-               fi
-    
-               sed "s/HOST/$vhostname/g; s/DOMAIN/$DOMAIN/g;
-                    s#DOCROOT#$docroot#g; s/IPADDR/$MYIP/g" < $TMPLDIR/$vhosttmpl >> $out
-               cp_mv $out $vhostdir/$vhost
-               chmod 644 $vhostdir/$vhost
-               ln -fs ../sites-available/$vhost $venabledir/$venabled    
-    
-               if [ -n "$mkdir_docroot" -a ! -d "$docroot" ]; then
-                       mkdir "$docroot"
-                       echo '<html><body><h1>Radi!</h1></body></html>' > "$docroot/index.html"
-               elif [ -n "$symlink_docroot" ]; then
-                       ln -fs "$symlink_docroot" "$docroot"
-               fi
-
-               need_restart=1
-       fi
+        sed "s/HOST/$vhostname/g; s/DOMAIN/$DOMAIN/g;
+            s#DOCROOT#$docroot#g; s/IPADDR/$MYIP/g" < $TMPLDIR/$vhosttmpl >> $out
+        cp_mv $out $vhostdir/$vhost
+        chmod 644 $vhostdir/$vhost
+        ln -fs ../sites-available/$vhost $venabledir/$venabled
+
+        if [ -n "$mkdir_docroot" -a ! -d "$docroot" ]; then
+            mkdir "$docroot"
+            echo '<html><body><h1>Radi!</h1></body></html>' > "$docroot/index.html"
+        elif [ -n "$symlink_docroot" ]; then
+            ln -fs "$symlink_docroot" "$docroot"
+        fi
+
+        need_restart=1
+    fi
 }
 
 
@@ -293,30 +286,30 @@ trap cleanup 0 1 2 15
 # /etc/apache2/sites-available/ directories.
 #
 if [ -e "$CONF" ]; then
-       cp_echo "CN: Doing backup for $CONF"
-       cp_backup_conffile -d $BACKUPDIR -p $CONF
-       backup_done=1
+    cp_echo "CN: Doing backup for $CONF"
+    cp_backup_conffile -d $BACKUPDIR -p $CONF
+    backup_done=1
 fi
 if [ -d "$CONFDIR/conf.d" ] && [ -n "$(ls ${CONFDIR}/conf.d/)" ]; then
-       cp_echo "CN: Doing backup for all files in /etc/apache2/conf.d/"
-       for file in /etc/apache2/conf.d/*; do
-           if [ -z "$(echo $file | egrep '^/.*~')" ]; then
-               cp_backup_conffile -d $BACKUPDIR -p $file
-           fi
-       done
-       backup_done=1
+    cp_echo "CN: Doing backup for all files in /etc/apache2/conf.d/"
+    for file in /etc/apache2/conf.d/*; do
+        if [ -z "$(echo $file | egrep '^/.*~')" ]; then
+            cp_backup_conffile -d $BACKUPDIR -p $file
+        fi
+    done
+    backup_done=1
 fi
 if [ -d "$CONFDIR/sites-available" ] && [ -n "$(ls ${CONFDIR}/sites-available/)" ]; then
-       cp_echo "CN: Doing backup for all files in /etc/apache2/sites-available/"
-       for file in /etc/apache2/sites-available/*; do
-           if [ -z "$(echo $file | egrep '^/.*~')" ]; then
-               cp_backup_conffile -d $BACKUPDIR -p $file
-           fi
-       done
-       backup_done=1
+    cp_echo "CN: Doing backup for all files in /etc/apache2/sites-available/"
+    for file in /etc/apache2/sites-available/*; do
+        if [ -z "$(echo $file | egrep '^/.*~')" ]; then
+            cp_backup_conffile -d $BACKUPDIR -p $file
+        fi
+    done
+    backup_done=1
 fi
 if [ $backup_done -eq 1 ]; then
-       cp_echo "CN: Backup is located in directory: $BACKUPDIR/"
+    cp_echo "CN: Backup is located in directory: $BACKUPDIR/"
 fi
 
 
@@ -324,43 +317,43 @@ fi
 #
 if [ -e "$CONF" ]; then
 
-       if [ ! -e "$A2MODEDIR/cgi.load" ]; then
-               cp_echo "CN: Enabling CGI module for Apache2 web server."
-               a2enmod cgi >/dev/null || true
-               need_restart=1
-       fi
-
-       if [ ! -e "$A2MODEDIR/rewrite.load" ]; then
-               cp_echo "CN: Enabling rewrite module for Apache2 web server."
-               a2enmod rewrite >/dev/null || true
-               need_restart=1
-       fi
-
-       if [ ! -e "$A2MODEDIR/userdir.load" ] || [ ! -e "$A2MODEDIR/userdir.conf" ]; then
-               cp_echo "CN: Enabling userdir module for Apache2 web server."
-               a2enmod userdir >/dev/null || true
-               need_restart=1
-       fi
-
-       if [ ! -e "$A2MODEDIR/suexec.load" ]; then
-               cp_echo "CN: Enabling SUEXEC module for Apache2 web server."
-               a2enmod suexec >/dev/null || true
-               need_restart=1
-       fi
-
-       if [ ! -e "$A2MODEDIR/php5.load" ] || [ ! -e "$A2MODEDIR/php5.conf" ]; then
-           if [ -e "/usr/lib/apache2/modules/libphp5.so" ]; then
-               cp_echo "CN: Enabling PHP5 module for Apache2 web server."
-               a2enmod php5 >/dev/null || true
-               need_restart=1
-           fi
-       fi
-
-       if [ ! -e "$A2MODEDIR/ssl.load" ] || [ ! -e "$A2MODEDIR/ssl.conf" ]; then
-               cp_echo "CN: Enabling SSL module for Apache2 web server."
-               a2enmod ssl >/dev/null || true
-               need_restart=1
-       fi
+    if [ ! -e "$A2MODEDIR/cgi.load" ]; then
+        cp_echo "CN: Enabling CGI module for Apache2 web server."
+        a2enmod cgi >/dev/null || true
+        need_restart=1
+    fi
+
+    if [ ! -e "$A2MODEDIR/rewrite.load" ]; then
+        cp_echo "CN: Enabling rewrite module for Apache2 web server."
+        a2enmod rewrite >/dev/null || true
+        need_restart=1
+    fi
+
+    if [ ! -e "$A2MODEDIR/userdir.load" ] || [ ! -e "$A2MODEDIR/userdir.conf" ]; then
+        cp_echo "CN: Enabling userdir module for Apache2 web server."
+        a2enmod userdir >/dev/null || true
+        need_restart=1
+    fi
+
+    if [ ! -e "$A2MODEDIR/suexec.load" ]; then
+        cp_echo "CN: Enabling SUEXEC module for Apache2 web server."
+        a2enmod suexec >/dev/null || true
+        need_restart=1
+    fi
+
+    if [ ! -e "$A2MODEDIR/php5.load" ] || [ ! -e "$A2MODEDIR/php5.conf" ]; then
+        if [ -e "/usr/lib/apache2/modules/libphp5.so" ]; then
+            cp_echo "CN: Enabling PHP5 module for Apache2 web server."
+            a2enmod php5 >/dev/null || true
+            need_restart=1
+        fi
+    fi
+
+    if [ ! -e "$A2MODEDIR/ssl.load" ] || [ ! -e "$A2MODEDIR/ssl.conf" ]; then
+        cp_echo "CN: Enabling SSL module for Apache2 web server."
+        a2enmod ssl >/dev/null || true
+        need_restart=1
+    fi
 fi
 
 
@@ -375,12 +368,12 @@ listen_ssl
 # Disable default site configuration.
 #
 if [ -e "$CONF" ]; then
-       if [ -e "$CONFDIR/sites-enabled/000-default" ]; then
-               cp_echo "CN: Disabling 000-default site configuration."
-               a2dissite 000-default >/dev/null || true
+    if [ -e "$CONFDIR/sites-enabled/000-default" ]; then
+        cp_echo "CN: Disabling 000-default site configuration."
+        a2dissite 000-default >/dev/null || true
 
-               need_restart=1
-       fi
+        need_restart=1
+    fi
 fi
 
 
@@ -389,45 +382,45 @@ fi
 has_listen_ssl=0
 
 if [ -d "$CONFDIR/conf.d" ] && [ -n "$(ls $CONFDIR/conf.d)" ]; then
-       listen_ssl_mask=$CONFDIR/conf.d/*
+    listen_ssl_mask=$CONFDIR/conf.d/*
 fi
 if [ -d "$CONFDIR/sites-enabled" ] && [ -n "$(ls $CONFDIR/sites-enabled)" ]; then
-       listen_ssl_mask=$listen_ssl_mask" "$CONFDIR/sites-enabled/*
+    listen_ssl_mask=$listen_ssl_mask" "$CONFDIR/sites-enabled/*
 fi
 
 for file in $CONF $listen_ssl_mask; do
-       if [ -f "$file" ]; then
-               if egrep -iq '^[[:space:]]*<VirtualHost .*443[[:space:]]*>' $file; then
-                       has_listen_ssl=1
-                       apache2_sslcert=1
-                       break
-               fi
-       fi
+    if [ -f "$file" ]; then
+        if egrep -iq '^[[:space:]]*<VirtualHost .*443[[:space:]]*>' $file; then
+            has_listen_ssl=1
+            apache2_sslcert=1
+            break
+        fi
+    fi
 done
 
 if [ $apache2_sslcert -eq 0 ]; then
 
-       db_get apache2-cn/sslcf || true
-       apache2_sslcf="$RET"
+    db_get apache2-cn/sslcf || true
+    apache2_sslcf="$RET"
+
+    if [ -n "$apache2_sslcf" ]; then
 
-       if [ -n "$apache2_sslcf" ]; then
+        db_get apache2-cn/sslckf || true
+        apache2_sslckf="$RET"
 
-               db_get apache2-cn/sslckf || true
-               apache2_sslckf="$RET"
+        db_get apache2-cn/sslccf || true
+        apache2_sslccf="$RET"
 
-               db_get apache2-cn/sslccf || true
-               apache2_sslccf="$RET"
-       
-               need_restart=1
-       else
+        need_restart=1
+    else
 
-               # Generate new SSL certificate files.
-               generate_ssl
-       
-               apache2_sslcf=
-               apache2_sslckf=
-               apache2_sslccf=
-       fi
+        # Generate new SSL certificate files.
+        generate_ssl
+
+        apache2_sslcf=
+        apache2_sslckf=
+        apache2_sslccf=
+    fi
 fi
 
 
@@ -439,45 +432,45 @@ if [ -z "$2" ]; then
     db_get apache2-cn/wwwhost || true
     if [ "$RET" = "true" ]; then
 
-       # Add WWW VirtualHost.
-       if [ -f "$CONFDIR/sites-available/$FQDN" ]; then
-               cp_backup_conffile -d $BACKUPDIR -p $CONFDIR/sites-available/$FQDN
-       fi
-       if [ -f "$CONFDIR/sites-available/www.$DOMAIN" ]; then
-               cp_backup_conffile -d $BACKUPDIR -p $CONFDIR/sites-available/www.$DOMAIN
-       fi
-
-       chk_conf_tag "$CONFDIR/sites-available/$FQDN"
-       if [ ! -f "$CONFDIR/sites-available/$FQDN" ] || [ $RET -eq 0 ]; then
-               if egrep -qi "^[[:space:]]*NameVirtualHost[[:space:]]+\*:80$" "$PORTCONF"; then
-                       install_vhost -d -r www.$DOMAIN default $FQDN 000-$FQDN
-               else
-                       install_vhost -nvh -d -r www.$DOMAIN default $FQDN 000-$FQDN
-               fi
-               need_restart=1
-       fi
-
-       chk_conf_tag "$CONFDIR/sites-available/www.$DOMAIN"
-       if [ ! -f "$CONFDIR/sites-available/www.$DOMAIN" ] || [ $RET -eq 0 ]; then
-               install_vhost default www.$DOMAIN www.$DOMAIN
-               need_restart=1
-       fi
+        # Add WWW VirtualHost.
+        if [ -f "$CONFDIR/sites-available/$FQDN" ]; then
+            cp_backup_conffile -d $BACKUPDIR -p $CONFDIR/sites-available/$FQDN
+        fi
+        if [ -f "$CONFDIR/sites-available/www.$DOMAIN" ]; then
+            cp_backup_conffile -d $BACKUPDIR -p $CONFDIR/sites-available/www.$DOMAIN
+        fi
+
+        chk_conf_tag "$CONFDIR/sites-available/$FQDN"
+        if [ ! -f "$CONFDIR/sites-available/$FQDN" ] || [ $RET -eq 0 ]; then
+            if egrep -qi "^[[:space:]]*NameVirtualHost[[:space:]]+\*:80$" "$PORTCONF"; then
+                install_vhost -d -r www.$DOMAIN default $FQDN 000-$FQDN
+            else
+                install_vhost -nvh -d -r www.$DOMAIN default $FQDN 000-$FQDN
+            fi
+            need_restart=1
+        fi
+
+        chk_conf_tag "$CONFDIR/sites-available/www.$DOMAIN"
+        if [ ! -f "$CONFDIR/sites-available/www.$DOMAIN" ] || [ $RET -eq 0 ]; then
+            install_vhost default www.$DOMAIN www.$DOMAIN
+            need_restart=1
+        fi
     else
 
-       # No WWW VirtualHost.
-       if [ -f "$CONFDIR/sites-available/$FQDN" ]; then
-               cp_backup_conffile -d $BACKUPDIR -p $CONFDIR/sites-available/$FQDN
-       fi
-
-       chk_conf_tag "$CONFDIR/sites-available/$FQDN"
-       if [ ! -f "$CONFDIR/sites-available/$FQDN" ] || [ $RET -eq 0 ]; then
-               if egrep -qi "^[[:space:]]*NameVirtualHost[[:space:]]+\*:80$" "$PORTCONF"; then
-                       install_vhost -d -r $FQDN default $FQDN 000-$FQDN
-               else
-                       install_vhost -nvh -d -r $FQDN default $FQDN 000-$FQDN
-               fi
-               need_restart=1
-       fi
+        # No WWW VirtualHost.
+        if [ -f "$CONFDIR/sites-available/$FQDN" ]; then
+            cp_backup_conffile -d $BACKUPDIR -p $CONFDIR/sites-available/$FQDN
+        fi
+
+        chk_conf_tag "$CONFDIR/sites-available/$FQDN"
+        if [ ! -f "$CONFDIR/sites-available/$FQDN" ] || [ $RET -eq 0 ]; then
+            if egrep -qi "^[[:space:]]*NameVirtualHost[[:space:]]+\*:80$" "$PORTCONF"; then
+                install_vhost -d -r $FQDN default $FQDN 000-$FQDN
+            else
+                install_vhost -nvh -d -r $FQDN default $FQDN 000-$FQDN
+            fi
+            need_restart=1
+        fi
     fi
 fi
 
@@ -486,22 +479,22 @@ fi
 #
 if [ $apache2_sslcert -eq 0 ]; then
 
-        if [ -f "$CONFDIR/sites-available/ssl" ]; then
-                cp_backup_conffile -d $BACKUPDIR -p $CONFDIR/sites-available/ssl
-        fi
+    if [ -f "$CONFDIR/sites-available/ssl" ]; then
+        cp_backup_conffile -d $BACKUPDIR -p $CONFDIR/sites-available/ssl
+    fi
 
-       # No active SSL VirtualHosts found - add new one.
-       chk_conf_tag "$CONFDIR/sites-available/ssl"
-       if [ ! -f "$CONFDIR/sites-available/ssl" ] || [ $RET -eq 0 ]; then
-
-               db_get apache2-cn/wwwhost || true
-               if [ "$RET" = "true" ]; then
-                       install_vhost -r www.$DOMAIN -n $HOST ssl ssl 001-ssl
-               else
-                       install_vhost -r $FQDN -n $HOST ssl ssl 001-ssl
-               fi
-               need_restart=1
-       fi
+    # No active SSL VirtualHosts found - add new one.
+    chk_conf_tag "$CONFDIR/sites-available/ssl"
+    if [ ! -f "$CONFDIR/sites-available/ssl" ] || [ $RET -eq 0 ]; then
+
+        db_get apache2-cn/wwwhost || true
+        if [ "$RET" = "true" ]; then
+            install_vhost -r www.$DOMAIN -n $HOST ssl ssl 001-ssl
+        else
+            install_vhost -r $FQDN -n $HOST ssl ssl 001-ssl
+        fi
+        need_restart=1
+    fi
 fi
 
 
@@ -509,38 +502,38 @@ fi
 #
 if [ $apache2_sslcert -eq 0 ]; then
 
-       chk_conf_tag "${CONFDIR}/sites-available/ssl"
-       if [ $RET -eq 0 ] && [ -n "$apache2_sslcf" ]; then
+    chk_conf_tag "${CONFDIR}/sites-available/ssl"
+    if [ $RET -eq 0 ] && [ -n "$apache2_sslcf" ]; then
 
-               SSLTMP=$(mktemp ${CONFDIR}/ssltmp.XXXXXX)
-               temp_files="${temp_files} ${SSLTMP} ${SSLTMP}.cn-old"
-               cp ${CONFDIR}/sites-available/ssl $SSLTMP
+        SSLTMP=$(mktemp ${CONFDIR}/ssltmp.XXXXXX)
+        temp_files="${temp_files} ${SSLTMP} ${SSLTMP}.cn-old"
+        cp ${CONFDIR}/sites-available/ssl $SSLTMP
 
-               # SSLCertificateFile
-               cp_check_and_sed "^[[:space:]]*SSLCertificateFile \/etc\/ssl\/certs\/apache2\.pem" \
-                   "s#SSLCertificateFile /etc/ssl/certs/apache2.pem#SSLCertificateFile $apache2_sslcf #g" \
-                   $SSLTMP || true
+        # SSLCertificateFile
+        cp_check_and_sed "^[[:space:]]*SSLCertificateFile \/etc\/ssl\/certs\/apache2\.pem" \
+            "s#SSLCertificateFile /etc/ssl/certs/apache2.pem#SSLCertificateFile $apache2_sslcf #g" \
+        $SSLTMP || true
 
-               # SSLCertificateKeyFile
-               cp_check_and_sed "^[[:space:]]*SSLCertificateKeyFile \/etc\/ssl\/private\/apache2\.key" \
-                   "s#SSLCertificateKeyFile /etc/ssl/private/apache2.key#SSLCertificateKeyFile $apache2_sslckf #g" \
-                   $SSLTMP || true
+        # SSLCertificateKeyFile
+        cp_check_and_sed "^[[:space:]]*SSLCertificateKeyFile \/etc\/ssl\/private\/apache2\.key" \
+            "s#SSLCertificateKeyFile /etc/ssl/private/apache2.key#SSLCertificateKeyFile $apache2_sslckf #g" \
+        $SSLTMP || true
 
-               # SSLCertificateChainFile
-               if [ -n "$apache2_sslccf" ]; then
-                   cp_check_and_sed "^# SSLCertificateChainFile \/etc\/ssl\/certs/sureserverEDU\.pem" \
-                       "s#\# SSLCertificateChainFile /etc/ssl/certs/sureserverEDU.pem#SSLCertificateChainFile $apache2_sslccf #g" \
-                       $SSLTMP || true
-               fi
+        # SSLCertificateChainFile
+        if [ -n "$apache2_sslccf" ]; then
+            cp_check_and_sed "^# SSLCertificateChainFile \/etc\/ssl\/certs/sureserverEDU\.pem" \
+                "s#\# SSLCertificateChainFile /etc/ssl/certs/sureserverEDU.pem#SSLCertificateChainFile $apache2_sslccf #g" \
+            $SSLTMP || true
+        fi
 
-               cp_mv $SSLTMP ${CONFDIR}/sites-available/ssl
+        cp_mv $SSLTMP ${CONFDIR}/sites-available/ssl
 
-               need_restart=1
+        need_restart=1
 
-               # Just to be sure.
-               [ -e "${SSLTMP}" ] && rm -f ${SSLTMP}
-               [ -e "${SSLTMP}.cn-old" ] && rm -f ${SSLTMP}.cn-old
-       fi
+        # Just to be sure.
+        [ -e "${SSLTMP}" ] && rm -f ${SSLTMP}
+        [ -e "${SSLTMP}.cn-old" ] && rm -f ${SSLTMP}.cn-old
+    fi
 fi
 
 
@@ -550,9 +543,9 @@ cp_echo "CN: Checking file access permissions for Apache2 SSL certificates."
 sslkey=/etc/ssl/private
 sslcerts="${sslkey}/ca.key ${sslkey}/apache2-ca.key ${sslkey}/apache2.key"
 for certf in $sslcerts; do
-       if [ -f "$certf" ]; then
-           chmod 600 $certf
-       fi
+    if [ -f "$certf" ]; then
+        chmod 600 $certf
+    fi
 done
 
 
@@ -561,17 +554,17 @@ done
 #
 if egrep -iq "^[[:space:]]*Include[[:space:]]+\/etc\/apache2\/sites-enabled\/\[\^\.\#\]\*$" "$CONF"; then
 
-       cp_echo "CN: Fixing obsolete Include line in $CONF."
-       CONFTMP=`mktemp $CONF.tmp.XXXXXX`
-       sed -r "/^[[:space:]]*Include[[:space:]]+\/etc\/apache2\/sites-enabled\/\[\^\.\#\]\*$/Id" \
-               "$CONF" > "$CONFTMP"
+    cp_echo "CN: Fixing obsolete Include line in $CONF."
+    CONFTMP=`mktemp $CONF.tmp.XXXXXX`
+    sed -r "/^[[:space:]]*Include[[:space:]]+\/etc\/apache2\/sites-enabled\/\[\^\.\#\]\*$/Id" \
+        "$CONF" > "$CONFTMP"
 
-       if ! egrep -iq "^[[:space:]]*Include[[:space:]]+\/etc\/apache2\/sites-enabled\/$" "$CONFTMP"; then
-               echo "Include /etc/apache2/sites-enabled/" >> "$CONFTMP"
-       fi
+    if ! egrep -iq "^[[:space:]]*Include[[:space:]]+\/etc\/apache2\/sites-enabled\/$" "$CONFTMP"; then
+        echo "Include /etc/apache2/sites-enabled/" >> "$CONFTMP"
+    fi
 
-       cp_mv "$CONFTMP" "$CONF"
-       need_restart=1
+    cp_mv "$CONFTMP" "$CONF"
+    need_restart=1
 fi
 
 
@@ -581,8 +574,8 @@ db_stop || true
 # Remove old AOSI configuration for Apache: aosi-www.conf, aosi.conf.
 #
 if [ -e "$CONFDIR/conf.d/aosi-www.conf" ] || [ -e "$CONFDIR/conf.d/aosi.conf" ]; then
-       cp_echo "CN: Removing old AOSI configuration files for Apache2."
-       need_restart=1
+    cp_echo "CN: Removing old AOSI configuration files for Apache2."
+    need_restart=1
 fi
 [ -e "$CONFDIR/conf.d/aosi-www.conf" ] && rm -f $CONFDIR/conf.d/aosi-www.conf
 [ -e "$CONFDIR/conf.d/aosi.conf" ] && rm -f $CONFDIR/conf.d/aosi.conf
@@ -592,23 +585,17 @@ fi
 #
 if [ $need_restart -eq 1 ]; then
 
-       # Check Apache2 web server configuration.
-       if apache2ctl configtest 2>/dev/null; then
-
-               # Restart Apache2 web server.
-               if [ -x "/etc/init.d/apache2" ]; then
-                   if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
-                       invoke-rc.d apache2 restart || true
-                   else
-                       /etc/init.d/apache2 restart || true
-                   fi
-               fi
-       else
-
-               # Something is broken.
-               cp_echo "CN: Your Apache2 configuration seem to be broken."
-               cp_echo "CN: Please, check the service after the installation finishes!"
-       fi
+    # Check Apache2 web server configuration.
+    if apache2ctl configtest 2>/dev/null; then
+
+        # Restart Apache2 web server.
+        invoke-rc.d apache2 restart || true
+    else
+
+        # Something is broken.
+        cp_echo "CN: Your Apache2 configuration seem to be broken."
+        cp_echo "CN: Please, check the service after the installation finishes!"
+    fi
 fi
 
 
@@ -620,9 +607,10 @@ cp_mail "$PKG"
 # (re)generate monit.d files if monit-cn is installed.
 #
 if [ -x "/usr/sbin/update-monit.d" ]; then
-       cp_echo "CN: Updating monit configuration..."
-       update-monit.d || true
+    cp_echo "CN: Updating monit configuration..."
+    update-monit.d || true
 fi
 
+#DEBHELPER#
 
 exit 0
index 3814404..3324e2a 100755 (executable)
@@ -2,9 +2,6 @@
 
 set -e
 
-# Debconf
-. /usr/share/debconf/confmodule
-
 # Include CARNet functions.
 . /usr/share/carnet-tools/functions.sh
 
@@ -16,75 +13,71 @@ sitefiles=
 
 
 case "$1" in
-       purge)
-                # Get CARNet config files in /etc/apache2/sites-available directory.
-                if [ -d "${sitesdir}" ] && [ -n "$(ls ${sitesdir}/)" ]; then
-
-                    for file in ${sitesdir}/*; do
-                        if [ -f "$file" ]; then
-                            if egrep -q "^## Begin - Generated by CARNet package apache2-cn$" $file; then
-                                site=`echo "$file" | sed 's/^\/.*\///'`
-                                sitefiles="$sitefiles $site"
-                            fi
+    purge)
+        # Get CARNet config files in /etc/apache2/sites-available directory.
+        if [ -d "${sitesdir}" ] && [ -n "$(ls ${sitesdir}/)" ]; then
+
+            for file in ${sitesdir}/*; do
+                if [ -f "$file" ]; then
+                    if egrep -q "^## Begin - Generated by CARNet package apache2-cn$" $file; then
+                        site=`echo "$file" | sed 's/^\/.*\///'`
+                        sitefiles="$sitefiles $site"
+                    fi
+                fi
+            done
+        fi
+
+        # Remove our vhosts.
+        if [ -n "$sitefiles" ]; then
+            for site in $sitefiles; do
+
+                if [ -e "$sitesdir/$site" ]; then
+
+                    cp_echo "CN: Removing $site site configuration file."
+                    rm -f $sitesdir/$site
+                fi
+            done
+        fi
+
+        # Remove default DocumentRoot if there's only a one line index.html there
+        docroots="/var/www/$HOST /var/www/www.$DOMAIN"
+
+        if [ -d "/var/www" ]; then
+
+            for docroot in $docroots; do
+
+                if [ -d $docroot ]; then
+                    if [ "x$(echo ${docroot}/*)" = "x${docroot}/index.html" ]; then
+                        if [ "$(wc -l ${docroot}/index.html | awk '{print $1}')" -eq 1 ]; then
+
+                            cp_echo "CN: Removing document root directory ${docroot}."
+                            rm -f $docroot/index.html
+                            rmdir $docroot || true
                         fi
-                    done
+                    fi
                 fi
-               
-               # Remove our vhosts.
-               if [ -n "$sitefiles" ]; then
-                   for site in $sitefiles; do
-               
-                       if [ -e "$sitesdir/$site" ]; then
-
-                           cp_echo "CN: Removing $site site configuration file."
-                           rm -f $sitesdir/$site
-                       fi
-                   done
-               fi
-               
-               # Remove default DocumentRoot if there's only a one line index.html there
-               docroots="/var/www/$HOST /var/www/www.$DOMAIN"
-               
-               if [ -d "/var/www" ]; then
-               
-                   for docroot in $docroots; do
-
-                       if [ -d $docroot ]; then
-                           if [ "x$(echo ${docroot}/*)" = "x${docroot}/index.html" ]; then
-                               if [ "$(wc -l ${docroot}/index.html | awk '{print $1}')" -eq 1 ]; then
-               
-                                   cp_echo "CN: Removing document root directory ${docroot}."
-                                   rm -f $docroot/index.html
-                                   rmdir $docroot || true
-                               fi
-                           fi
-                       fi
-                   done
-               fi
-               
-               # Remove CARNet specific configuration.
-               if [ -d "${CONFDIR}/conf.d" ] && [ -n "$(ls ${CONFDIR}/conf.d/)" ]; then
-                   cp_echo "CN: Disabling CARNet specific configuration."
-                   for file in ${CONFDIR}/conf.d/*; do
-                       if [ -f "$file" ]; then
-                           if egrep -q "^## Begin - Generated by CARNet package apache2-cn$" $file; then
-                               rm -f $file
-                           fi
-                       fi
-                   done
-               fi
-
-               # Debconf purge
-               db_purge
-               
-               # Mail root
-               cp_mail "apache2-cn"
-               ;;
-       *)
-               ;;
-esac
+            done
+        fi
+
+        # Remove CARNet specific configuration.
+        if [ -d "${CONFDIR}/conf.d" ] && [ -n "$(ls ${CONFDIR}/conf.d/)" ]; then
+            cp_echo "CN: Disabling CARNet specific configuration."
+            for file in ${CONFDIR}/conf.d/*; do
+                if [ -f "$file" ]; then
+                    if egrep -q "^## Begin - Generated by CARNet package apache2-cn$" $file; then
+                        rm -f $file
+                    fi
+                fi
+            done
+        fi
 
+        # Mail root
+        cp_mail "apache2-cn"
+        ;;
+    *)
+        ;;
+esac
 
-db_stop
+#DEBHELPER#
 
 exit 0
index 7bc72f1..d35ba4f 100755 (executable)
@@ -11,69 +11,63 @@ sites=
 
 
 case "$1" in
-       remove|deconfigure)
-       
-               # Get CARNet config files in /etc/apache2/sites-enabled directory.
-               if [ -d "${sitesendir}" ] && [ -n "$(ls ${sitesendir}/)" ]; then
-               
-                   for file in ${sitesendir}/*; do
-                       if [ -f "$file" ]; then
-                           if egrep -q "^## Begin - Generated by CARNet package apache2-cn$" $file; then
-                               site=`echo "$file" | sed 's/^\/.*\///'`
-                               sites="$sites $site"
-                           fi
-                       fi
-                   done
-               fi
-
-               # Deconfigure our web sites, do nothing else
-               if [ -n "$sites" ]; then
-                   for site in $sites; do
-               
-                       if [ -e "$sitesendir/$site" ]; then
-
-                           cp_echo "CN: Disabling $site site configuration."
-                           rm -f $sitesendir/$site
-                       fi
-                   done
-               fi
-
-               if [ -f "${CONFDIR}/sites-available/default" ]; then
-                   cp_echo "CN: Enabling default site configuration for Apache2 web server."
-                   a2ensite default >/dev/null || true
-               fi
-
-               # Restart Apache2 web server.
-               if apache2ctl configtest 2>/dev/null; then
-
-                       # Restart Apache2 web server.
-                       if [ -x "/etc/init.d/apache2" ]; then
-                           if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
-                               invoke-rc.d apache2 restart || true
-                           else
-                               /etc/init.d/apache2 restart || true
-                           fi
-                       fi
-               else
-               
-                       # Something is broken.
-                       cp_echo "CN: Your Apache2 configuration seem to be broken."
-                       cp_echo "CN: Please, check the service configuration!"
-               fi
-               
-               # Mail root
-               cp_mail "apache2-cn"
-
-               echo
-               ;;
-       upgrade)
-               ;;
-       failed-upgrade)
-               ;;
-       *)
-               echo "prerm called with unknown argument \`$1'" >&2
-               exit 0
-               ;;
+    remove|deconfigure)
+
+        # Get CARNet config files in /etc/apache2/sites-enabled directory.
+        if [ -d "${sitesendir}" ] && [ -n "$(ls ${sitesendir}/)" ]; then
+
+            for file in ${sitesendir}/*; do
+                if [ -f "$file" ]; then
+                    if egrep -q "^## Begin - Generated by CARNet package apache2-cn$" $file; then
+                        site=`echo "$file" | sed 's/^\/.*\///'`
+                        sites="$sites $site"
+                    fi
+                fi
+            done
+        fi
+
+        # Deconfigure our web sites, do nothing else
+        if [ -n "$sites" ]; then
+            for site in $sites; do
+
+                if [ -e "$sitesendir/$site" ]; then
+
+                    cp_echo "CN: Disabling $site site configuration."
+                    rm -f $sitesendir/$site
+                fi
+            done
+        fi
+
+        if [ -f "${CONFDIR}/sites-available/default" ]; then
+            cp_echo "CN: Enabling default site configuration for Apache2 web server."
+            a2ensite default >/dev/null || true
+        fi
+
+        # Restart Apache2 web server.
+        if apache2ctl configtest 2>/dev/null; then
+
+            # Restart Apache2 web server.
+            invoke-rc.d apache2 restart || true
+        else
+
+            # Something is broken.
+                cp_echo "CN: Your Apache2 configuration seem to be broken."
+                cp_echo "CN: Please, check the service configuration!"
+        fi
+
+        # Mail root
+        cp_mail "apache2-cn"
+        ;;
+    upgrade)
+        ;;
+    failed-upgrade)
+        ;;
+    *)
+        echo "prerm called with unknown argument \`$1'" >&2
+        exit 0
+        ;;
 esac
 
+#DEBHELPER#
+
 exit 0
index 59380b1..cbe925d 100755 (executable)
@@ -1,88 +1,3 @@
 #!/usr/bin/make -f
-# -*- makefile -*-
-# Sample debian/rules that uses debhelper.
-# This file was originally written by Joey Hess and Craig Small.
-# As a special exception, when this file is copied by dh-make into a
-# dh-make output file, you may use that output file without restriction.
-# This special exception was added by Craig Small in version 0.37 of dh-make.
-
-# Uncomment this to turn on verbose mode.
-#export DH_VERBOSE=1
-
-configure: configure-stamp
-configure-stamp:
-       dh_testdir
-       # Add here commands to configure the package.
-
-       touch configure-stamp
-
-
-build: build-stamp
-
-build-stamp: configure-stamp 
-       dh_testdir
-
-       # Add here commands to compile the package.
-       # $(MAKE)
-
-       touch build-stamp
-
-clean:
-       dh_testdir
-       dh_testroot
-       rm -f build-stamp configure-stamp
-
-       # Add here commands to clean up after the build process.
-       # -$(MAKE) clean
-
-       dh_clean 
-
-install: build
-       dh_testdir
-       dh_testroot
-       dh_clean -k 
-       dh_installdirs
-
-       # Add here commands to install the package into debian/apache2-cn
-       # $(MAKE) install DESTDIR=$(CURDIR)/debian/apache2-cn
-
-
-# Build architecture-independent files here.
-binary-indep: build install
-# We have nothing to do by default.
-
-# Build architecture-dependent files here.
-binary-arch: build install
-       dh_testdir
-       dh_testroot
-#      dh_installchangelogs -k
-#      dh_installdocs -X1.3 -n doc/*
-       dh_installchangelogs
-       dh_installdocs
-       dh_installexamples
-       dh_install -X.svn
-#      dh_installmenu
-       dh_installdebconf
-#      dh_installlogrotate
-#      dh_installemacsen
-#      dh_installpam
-#      dh_installmime
-#      dh_installinit
-#      dh_installcron
-#      dh_installinfo
-       dh_installman
-       dh_link
-#      dh_strip
-       dh_compress
-       dh_fixperms
-       dh_perl usr/share/apache2-cn
-#      dh_python
-#      dh_makeshlibs
-       dh_installdeb
-       dh_shlibdeps
-       dh_gencontrol
-       dh_md5sums
-       dh_builddeb
-
-binary: binary-indep binary-arch
-.PHONY: build clean binary-indep binary-arch binary install configure
+%:
+       dh $@
index c893ff8..5135adc 100644 (file)
@@ -1,6 +1,6 @@
 Template: apache2-cn/sslcf
 Type: string
-Description: SSL Certificate:
+_Description: SSL Certificate:
  Upisite lokaciju vec postojeceg SSL certifikata. U slucaju da nemate
  SSL certifikate, ostavite ovo polje praznim - ne morate nista upisivati.
  Instalacija ce automatski generirati SSL certifikat i obaviti konfiguraciju
@@ -10,14 +10,14 @@ Description: SSL Certificate:
 
 Template: apache2-cn/sslckf
 Type: string
-Description: SSL Certificate Key:
+_Description: SSL Certificate Key:
  Upisite lokaciju vec postojece datoteke koja sadrzi SSL kljuc.
  .
  Primjer: /etc/ssl/private/apache2.key
 
 Template: apache2-cn/sslccf
 Type: string
-Description: SSL Certificate Chain:
+_Description: SSL Certificate Chain:
  Upisite lokaciju vec postojece SSL chain datoteke. U slucaju da nemate
  SSL chain datoteku, ostavite ovo polje praznim.
  .
@@ -25,14 +25,14 @@ Description: SSL Certificate Chain:
 
 Template: apache2-cn/wwwhost
 Type: boolean
-Description: Dodati WWW VirtualHost u konfiguraciju web servera?
- Zelite li da Apache2 web server posluzuje i web stranice s adresom oblika
- ${www_domena}? U slucaju DA to zelite, Apache2 web server ce
+_Description: Dodati WWW VirtualHost u konfiguraciju web servera?
+ Apache2 web server moze posluzivati web stranice s adresom oblika
+ ${www_domena}. U slucaju DA to zelite, Apache2 web server ce
  posluzivati web stranice na adresama:
  .
  http://${stroj_domena}/, https://${www_domena}, te https://${www_domena} (SSL).
  .
- Ukoliko to NE zelite, Apache2 server ce posluzivati stranice na adresama:
+ Ako to NE zelite, Apache2 server ce posluzivati stranice na adresama:
  .
  http://${stroj_domena} i https://${stroj_domena}.