# TODO
-# - test build on amd64 and sheck /usr/lib64 patch
+# - test build on amd64 and check /usr/lib64 patch
# - cosmetics (sort in %%files and %%install)
# - contrib split
#
Summary(pl): System Zarz±dzania Sieci± Lokaln±
Name: lms
Version: %{lmsver}.%{lmssubver}
-Release: 1.1
+Release: 2
License: GPL
Vendor: LMS Developers
Group: Networking/Utilities
%{?with_lmsd:BuildRequires: mysql-devel}
%{?with_lmsd:BuildRequires: postgresql-devel}
%{?with_lmsd:Requires(post,preun): /sbin/chkconfig}
-Requires: Smarty >= 2.5.0
+Requires: Smarty >= 2.6.2
Requires: php
Requires: php-gd
Requires: php-iconv
Requires: php-pcre
Requires: php-posix
%{?with_lmsd:Requires: rc-scripts}
-Requires: webserver
+Requires: webapps
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
%define _sysconfdir /etc/%{name}
%define _lmsdir %{_datadir}/%{name}
%define _lmsvar /var/lib/%{name}
+%define _webapps /etc/webapps
+%define _webapp %{name}
%description
This is a package of applications in PHP and Perl for managing LANs.
%install
rm -rf $RPM_BUILD_ROOT
install -d $RPM_BUILD_ROOT%{_sbindir} \
- $RPM_BUILD_ROOT/etc/{rc.d/init.d,sysconfig,httpd} \
+ $RPM_BUILD_ROOT/etc/{rc.d/init.d,sysconfig} \
$RPM_BUILD_ROOT/etc/lms/modules/{dns,ggnofity,nofity} \
$RPM_BUILD_ROOT{%{_lmsvar}/{backups,templates_c},%{_libdir}/lms} \
$RPM_BUILD_ROOT%{_lmsdir}/www/{img,doc,user}
install bin/* $RPM_BUILD_ROOT%{_sbindir}
install sample/%{name}.ini $RPM_BUILD_ROOT%{_sysconfdir}
-install %{SOURCE1} $RPM_BUILD_ROOT/etc/httpd/%{name}.conf
+
+install -d $RPM_BUILD_ROOT%{_webapps}/%{_webapp}
+install %{SOURCE1} $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/apache.conf
+install %{SOURCE1} $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/httpd.conf
# sqlpanel
install contrib/sqlpanel/sql.php $RPM_BUILD_ROOT%{_lmsdir}/modules
%clean
rm -rf $RPM_BUILD_ROOT
-%post
-if [ -f /etc/httpd/httpd.conf ] && ! grep -q "^Include.*%{name}.conf" /etc/httpd/httpd.conf; then
- echo "Include /etc/httpd/%{name}.conf" >> /etc/httpd/httpd.conf
- if [ -f /var/lock/subsys/httpd ]; then
- /usr/sbin/apachectl restart 1>&2
- fi
-elif [ -d /etc/httpd/httpd.conf ]; then
- ln -sf /etc/httpd/%{name}.conf /etc/httpd/httpd.conf/99_%{name}.conf
- if [ -f /var/lock/subsys/httpd ]; then
- /usr/sbin/apachectl restart 1>&2
- fi
-fi
-
%post lmsd
/sbin/chkconfig --add lmsd
if [ -f /var/lock/subsys/lmsd ]; then
echo "Run \"/etc/rc.d/init.d/lmsd start\" to start lmsd daemon."
fi
-%preun
-if [ "$1" = "0" ]; then
- umask 027
- if [ -d /etc/httpd/httpd.conf ]; then
- rm -f /etc/httpd/httpd.conf/99_%{name}.conf
- else
- grep -v "^Include.*%{name}.conf" /etc/httpd/httpd.conf > \
- /etc/httpd/httpd.conf.tmp
- mv -f /etc/httpd/httpd.conf.tmp /etc/httpd/httpd.conf
- fi
- if [ -f /var/lock/subsys/httpd ]; then
- /usr/sbin/apachectl restart 1>&2
- fi
-fi
-
%preun lmsd
if [ "$1" = "0" ]; then
if [ -f /var/lock/subsys/lmsd ]; then
/sbin/chkconfig --del lmsd
fi
+%triggerin -- apache1
+%webapp_register apache %{_webapp}
+
+%triggerun -- apache1
+%webapp_unregister apache %{_webapp}
+
+%triggerin -- apache >= 2.0.0
+%webapp_register httpd %{_webapp}
+
+%triggerun -- apache >= 2.0.0
+%webapp_unregister httpd %{_webapp}
+
%triggerpostun -- %{name} <= 1.0.4
echo "WARNING!!!"
echo "_READ_ and upgrade LMS database:"
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
+
%files
%defattr(644,root,root,755)
%doc doc/{AUTHORS,ChangeLog*,INSTALL,README,UPGRADE*,lms*}
%dir %{_sysconfdir}
%attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/*.ini
-%config(noreplace) %verify(not md5 mtime size) /etc/httpd/%{name}.conf
+%dir %attr(750,root,http) %{_webapps}/%{_webapp}
+%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/apache.conf
+%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/httpd.conf
#
%dir %{_lmsvar}
%attr(770,root,http) %{_lmsvar}/backups