Public bug reported:

When installing cacti on a system with lighttpd already installed
debian/cacti.postinst runs but fails to set up a symlink for the file
lighttpd.conf

An excerpt of the code I believe to be at fault is here:

# Only try to add a symlink on a fresh install to respect
# changes done by the administrator
if [ "$2" = '' ]; then
    for server in $webservers; do
        if [ -d "/etc/${server}/conf.d" ]; then
            if [ ! -e "/etc/${server}/conf.d/cacti.conf" ] ; then
                ln -s ../../cacti/apache.conf "/etc/${server}/conf.d/cacti.conf"
            fi
            invoke-rc.d $server reload || true
        elif [ -d "/etc/${server}/conf-available" ]; then
            if [ ! -e "/etc/${server}/conf-available" ] ; then
                ln -s ../../cacti/lighttpd.conf 
"/etc/${server}/conf-available/cacti.conf"
            fi  
        fi
    done
fi

I've included the part about apache to show where in regards to the full
statement that the web server is restarted.

I believe the correct behavior should be as follows:

if [ "$2" = '' ]; then
   for server in $webservers; do
       if [ -d "/etc/${server}/conf.d" ]; then
           if [ ! -e "/etc/${server}/conf.d/cacti.conf" ] ; then
               ln -s ../../cacti/apache.conf "/etc/${server}/conf.d/cacti.conf"
           fi
       elif [ -d "/etc/${server}/conf-available" ]; then
           if [ ! -e "/etc/${server}/conf-available/20-cacti.conf" ] ; then
                  ln -s ../../cacti/lighttpd.conf 
"/etc/${server}/conf-available/20-cacti.conf"
                  lighty-enable-mod cacti
           fi
           invoke-rc.d $server reload || true
       fi
   done
fi

My changes reflect the fact that:
- it needs to check if the file already exists rather than checking the 
directory

- I've changed the file name to reflect what I believe to be an
appropriate interpretation of the naming convention for the debian take
on conf files for lighttpd which is nn-name where nn reflects the
priority number

- included a call to lighty-enable-mod to then enable the cacti conf
file (as we are installing cacti aren't we?)

- shifted the call to invoke a http reboot to after lighttpd statements
so that in both apache and lighttpd cases the daemon is restarted


There is also a problem with the lighttpd.conf file that is provided, it is as 
so:

# Cacti Alias
alias.url += (
        "/cacti" => "usr/share/cacti/site",
)

it should be:

# Cacti Alias
alias.url += (
        "/cacti" => "/usr/share/cacti/site",
)

to reflect that it is relative to the root directory rather than
current.

** Affects: cacti (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: cacti.conf cacti.postinst lighttpd lighttpd.conf

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1132415

Title:
  if statement for symlink of lighttpd.conf is wrong in cacti.postinst

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/cacti/+bug/1132415/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to