X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?a=blobdiff_plain;ds=sidebyside;f=debian%2Fpostrm;fp=debian%2Fpostrm;h=38144045edfef641fa149a41bfd4831fd258f495;hb=d0545bc48a700b22c3def9c648d97c6b80398cfe;hp=6681ea5b5801fdcf0e5dbf56c860cc5d9eb9c259;hpb=21104d185bc442f77672852c32d5cce6aa51bdb8;p=apache2-cn.git diff --git a/debian/postrm b/debian/postrm index 6681ea5..3814404 100755 --- a/debian/postrm +++ b/debian/postrm @@ -8,11 +8,11 @@ set -e # Include CARNet functions. . /usr/share/carnet-tools/functions.sh - +CONFDIR="/etc/apache2" +sitesdir=${CONFDIR}/sites-available HOST=$(hostname -f) DOMAIN=$(hostname -d) -sitefiles="000-$HOST www.$DOMAIN 001-ssl" -sitesdir=/etc/apache2/sites-available +sitefiles= case "$1" in @@ -20,7 +20,6 @@ case "$1" in # Get CARNet config files in /etc/apache2/sites-available directory. if [ -d "${sitesdir}" ] && [ -n "$(ls ${sitesdir}/)" ]; then - sitefiles="" for file in ${sitesdir}/*; do if [ -f "$file" ]; then if egrep -q "^## Begin - Generated by CARNet package apache2-cn$" $file; then @@ -32,17 +31,19 @@ case "$1" in fi # Remove our vhosts. - for site in $sitefiles; do + if [ -n "$sitefiles" ]; then + for site in $sitefiles; do - if [ -e "$sitesdir/$site" ]; then + if [ -e "$sitesdir/$site" ]; then - cp_echo "CN: Removing $site site configuration file." - rm -f $sitesdir/$site - fi - done + 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.$DOMAIN /var/www/www.$DOMAIN" + docroots="/var/www/$HOST /var/www/www.$DOMAIN" if [ -d "/var/www" ]; then @@ -62,11 +63,13 @@ case "$1" in fi # Remove CARNet specific configuration. - if [ -d "$CONFDIR/conf.d" ] && [ -n "$(ls ${CONFDIR}/conf.d/)" ]; then + if [ -d "${CONFDIR}/conf.d" ] && [ -n "$(ls ${CONFDIR}/conf.d/)" ]; then cp_echo "CN: Disabling CARNet specific configuration." - for file in /etc/apache2/conf.d/*; do - if egrep -q "^## Begin - Generated by CARNet package apache2-cn$" $file; then - rm -f $file + 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