-# TODO: test build on amd64 and sheck /usr/lib64 patch
+# TODO
+# - test build on amd64 and check /usr/lib64 patch
+# - cosmetics (sort in %%files and %%install)
+# - contrib split
#
# Conditional build:
%bcond_without lmsd # without lmsd daemon
#
-# TODO:
-# - cosmetics (sort in %%files and %%install)
-# - contrib split
-%define lmsver 1.6
-%define lmssubver 5
+%define lmsver 1.8
+%define lmssubver 0
Summary: LAN Managment System
Summary(pl): System Zarz±dzania Sieci± Lokaln±
Name: lms
Version: %{lmsver}.%{lmssubver}
-Release: 1
-License: GPL
+Release: 0.1
+License: GPL v2
Vendor: LMS Developers
Group: Networking/Utilities
Source0: http://lms.rulez.pl/download/%{lmsver}/%{name}-%{version}.tar.gz
-# Source0-md5: 617979bffb32052a5c7ffffdb7a355dd
+# Source0-md5: afa0680e112dc14c4fbb41d9ec2eedee
Source1: %{name}.conf
Source2: %{name}.init
Source3: %{name}.sysconfig
%{?with_lmsd:BuildRequires: libgadu-devel}
%{?with_lmsd:BuildRequires: mysql-devel}
%{?with_lmsd:BuildRequires: postgresql-devel}
-%{?with_lmsd:PreReq: rc-scripts}
%{?with_lmsd:Requires(post,preun): /sbin/chkconfig}
+Requires: Smarty >= 2.6.10-4
Requires: php
Requires: php-gd
Requires: php-iconv
-Requires: php-posix
Requires: php-pcre
-Requires: webserver
-Requires: Smarty >= 2.5.0
+Requires: php-posix
+%{?with_lmsd:Requires: rc-scripts}
+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.
It's using MySQL or PostgreSQL. The main goal is to get the best
service of users at provider's level. The main features in LMS are:
-- database of users (name, surname, address, telefon number,
+- database of users (name, surname, address, telephone number,
commentary);
- database of computers (IP, MAC);
- easy-ridden financial system and funds of network;
Summary: LAN Managment System - scripts
Summary(pl): LAN Managment System - skrypty
Group: Networking/Utilities
-Requires: perl-Net-SMTP-Server
Requires: perl-Config-IniFiles
Requires: perl-DBI
+Requires: perl-Net-SMTP-Server
%description scripts
This package contains scripts to integrate LMS with your system,
monthly billing, notify users about their debts and cutting off
-customers. Also you can build propably any kind of config file using
+customers. Also you can build probably any kind of config file using
lms-mgc.
%description scripts -l pl
./configure --with-mysql
%{__make} \
- CC='%{__cc}' CFLAGS='%{rpmcflags} -fPIC -DUSE_MYSQL -DLMS_LIB_DIR=\"/usr/lib/lms/\" -I../..'
+ CC='%{__cc}' CFLAGS='%{rpmcflags} -fPIC -DUSE_MYSQL -DLMS_LIB_DIR=\"%{_libdir}/lms/\" -I../..'
mv lmsd lmsd-mysql
./configure --with-pgsql
%{__make} lmsd \
CC='%{__cc}' \
- CFLAGS='%{rpmcflags} -fPIC -DUSE_PGSQL -DLMS_LIB_DIR=\"/usr/lib/lms/\" -I../..'
+ CFLAGS='%{rpmcflags} -fPIC -DUSE_PGSQL -DLMS_LIB_DIR=\"%{_libdir}/lms/\" -I../..'
mv lmsd lmsd-pgsql
cd ..
%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},/usr/lib/lms} \
+ $RPM_BUILD_ROOT{%{_lmsvar}/{backups,templates_c},%{_libdir}/lms} \
$RPM_BUILD_ROOT%{_lmsdir}/www/{img,doc,user}
install *.php $RPM_BUILD_ROOT%{_lmsdir}/www
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
# daemon
%if %{with lmsd}
install daemon/lmsd-* $RPM_BUILD_ROOT%{_sbindir}
-install daemon/modules/*/*.so $RPM_BUILD_ROOT/usr/lib/lms
+install daemon/modules/*/*.so $RPM_BUILD_ROOT%{_libdir}/lms
cp -r daemon/modules/dns/sample $RPM_BUILD_ROOT%{_sysconfdir}/modules/dns
cp -r daemon/modules/ggnotify/sample $RPM_BUILD_ROOT%{_sysconfdir}/modules/ggnotify
cp -r daemon/modules/dns/sample $RPM_BUILD_ROOT%{_sysconfdir}/modules/nofity
%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.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 "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
+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
%files
%defattr(644,root,root,755)
-%doc doc/{AUTHORS,ChangeLog*,README,UPGRADE*,lms*}
+%doc doc/{AUTHORS,ChangeLog,INSTALL,README*,lms*}
%dir %{_sysconfdir}
-%attr(640,root,http) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/*.ini
-%config(noreplace) %verify(not size mtime md5) /etc/httpd/%{name}.conf
+%attr(640,root,http) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/*.ini
+%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
%files lmsd
%defattr(644,root,root,755)
%attr(755,root,root) %{_sbindir}/lmsd-*
-%attr(755,root,root) /usr/lib/lms/*.so
+%attr(755,root,root) %{_libdir}/lms/*.so
%attr(754,root,root) /etc/rc.d/init.d/lmsd
/etc/lms/modules/*
%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}