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.
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 {server} /conf.d" ]; then {server} /conf.d/ cacti.conf" ] ; then apache. conf "/etc/$ {server} /conf.d/ cacti.conf"
invoke- rc.d $server reload || true {server} /conf-available " ]; then {server} /conf-available " ] ; then lighttpd. conf "/etc/$ {server} /conf-available /cacti. conf"
# changes done by the administrator
if [ "$2" = '' ]; then
for server in $webservers; do
if [ -d "/etc/$
if [ ! -e "/etc/$
ln -s ../../cacti/
fi
elif [ -d "/etc/$
if [ ! -e "/etc/$
ln -s ../../cacti/
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 {server} /conf.d" ]; then {server} /conf.d/ cacti.conf" ] ; then apache. conf "/etc/$ {server} /conf.d/ cacti.conf" {server} /conf-available " ]; then {server} /conf-available /20-cacti. conf" ] ; then
ln -s ../../cacti/ lighttpd. conf "/etc/$ {server} /conf-available /20-cacti. conf"
lighty- enable- mod cacti
invoke- rc.d $server reload || true
for server in $webservers; do
if [ -d "/etc/$
if [ ! -e "/etc/$
ln -s ../../cacti/
fi
elif [ -d "/etc/$
if [ ! -e "/etc/$
fi
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 cacti/site" ,
alias.url += (
"/cacti" => "usr/share/
)
it should be:
# Cacti Alias cacti/site" ,
alias.url += (
"/cacti" => "/usr/share/
)
to reflect that it is relative to the root directory rather than current.