[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: apache2 issues



On 29 July 2014 09:40, Brian May <brian@microcomaustralia.com.au> wrote:
 if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then
    . /usr/share/apache2/apache2-maintscript-helper
    apache2_invoke enconf package.conf
elif  dpkg-query -f '${Version}'  -W 'apache2.2-common' > /dev/null 2>&1 ; then
    # if the configuration uses <IfVersion> uncomment the next line
    # a2enmod -q version
    [ -d /etc/apache2/conf.d/ ] && [ ! -l /etc/apache2/conf.d/package.conf ] && ln -s ../conf-available/package.conf /etc/apache2/conf.d/package.conf
fi

Like I said, that 2nd condition doesn't seem to work correctly, and comes with a false positive in sid if apache2-bin is installed (I still don't understand this).

Maybe something like (full postinst file):

=== cut ===
#!/bin/sh -e

apache_force_reload() {                                                          
    if apache2ctl configtest 2>/dev/null; then                                   
        invoke-rc.d apache2 restart || true                                      
    else                                                                         
        echo "Your apache2 configuration is broken, please fix it and restart apache2 manually."
    fi                                                                           
}                                                                                

if [ "$1" = "configure" ]; then
    if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then
        . /usr/share/apache2/apache2-maintscript-helper
        apache2_invoke enconf package.conf
    elif  command -v apache2 > /dev/null && apache2 -v | sed -n 's/^Server version: //p' | grep -q 'Apache/2.2'; then
        ln -sf ../conf-available/package.conf /etc/apache2/conf.d/package.conf
        apache_force_reload
    fi
fi

#DEBHELPER#
=== cut ===

It appears to work both on wheezy and sid.

The ln -sf might be an oversimplification, will fail if the sysadmin has deleted /etc/apache2/conf.d - I consider this unlikely however.

Possibly #DEBHELPER# should come first.

It also appears that "a2enmod -q version" is not required, and generates an error, both on wheezy and sid, so I removed that comment.
--
Brian May <brian@microcomaustralia.com.au>

Reply to: