+%post lmsd
+/sbin/chkconfig --add lmsd
+if [ -f /var/lock/subsys/lmsd ]; then
+ /etc/rc.d/init.d/lmsd restart >&2
+else
+ echo "Run \"/etc/rc.d/init.d/lmsd start\" to start lmsd daemon."
+fi
+
+%preun lmsd
+if [ "$1" = "0" ]; then
+ if [ -f /var/lock/subsys/lmsd ]; then
+ /etc/rc.d/init.d/lmsd stop >&2
+ fi
+ /sbin/chkconfig --del lmsd
+fi
+
+%triggerin -- apache1
+%webapp_register apache %{_webapp}
+
+%triggerun -- apache1
+%webapp_unregister apache %{_webapp}
+
+%triggerin -- apache < 2.2.0, apache-base
+%webapp_register httpd %{_webapp}
+
+%triggerun -- apache < 2.2.0, apache-base
+%webapp_unregister httpd %{_webapp}
+
+%triggerpostun -- %{name} <= 1.0.4
+echo "WARNING!!!"
+echo "_READ_ and upgrade LMS database:"
+echo "MySQL: /usr/share/doc/%{name}-%{version}/UPGRADE-1.0-1.5.mysql.gz"
+echo "PostgreSQL: /usr/share/doc/%{name}-%{version}/UPGRADE-1.0-1.5.pgsql.gz"
+
+%triggerpostun -- %{name} <= 1.2.0
+echo "BEWARE:"
+echo "Automatic upgrade from LMS<= 1.2.0 is NO LONGER SUPPORTED by lms team"
+echo "You are advised to upgrade it manually"
+echo
+
+%triggerpostun -- %{name} < 1.6.6-1.4
+# nuke very-old config location (this mostly for Ra)
+if [ -f /etc/httpd/httpd.conf ]; then
+ sed -i -e "/^Include.*%{name}.conf/d" /etc/httpd/httpd.conf
+fi
+
+# migrate from httpd (apache2) config dir
+if [ -f /etc/httpd/%{name}.conf.rpmsave ]; then
+ cp -f %{_webapps}/%{_webapp}/httpd.conf{,.rpmnew}
+ mv -f /etc/httpd/%{name}.conf.rpmsave %{_webapps}/%{_webapp}/httpd.conf
+fi
+
+rm -f /etc/httpd/httpd.conf/99_%{name}.conf
+/usr/sbin/webapp register httpd %{_webapp}
+%service -q httpd reload
+