%define webuser apache %define webgroup apache %define squidgroup squid %define apache_confdir /httpd/conf.d %define srcname sams2 %bcond_without web %bcond_without doc %bcond_without devel Summary: SAMS2 (Squid Account Management System) Name: sams Version: 2.0.0 Release: rc1%{dist} Source0: http://sams.perm.ru/download/%{name}-%{version}-rc1.tar.bz2 Patch0: sams2.shebang.patch License: GPLv2+ Group: Applications/Internet URL: http://sams.perm.ru/ BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) Requires: mysql-server Requires: postgresql-server Requires: unixODBC Requires: pcre Requires: squid BuildRequires: mysql-devel BuildRequires: postgresql-devel BuildRequires: unixODBC-devel BuildRequires: gcc-c++ BuildRequires: pcre-devel BuildRequires: autoconf BuildRequires: automake BuildRequires: libtool BuildRequires: zlib-devel BuildRequires: chrpath BuildRequires: sed BuildRequires: httpd %description This program basically used for administrative purposes of squid proxy. There are access control for users by NTLM, LDAP, NCSA, BASIC or IP authorization mode. %post /sbin/ldconfig /sbin/chkconfig --add %{srcname} %postun -p /sbin/ldconfig %preun if [ $1 = 0 ]; then /sbin/service %{srcname} stop > /dev/null 2>&1 /sbin/chkconfig --del %{srcname} fi ####################################################################### %if 0%{?with_devel} %package devel Summary:SAMS2 devel package Group:Applications/System %description devel The %{srcname}-devel package. %endif ####################################################################### %if 0%{?with_web} %package web Summary:SAMS2 web administration tool Group:Applications/System Requires: httpd Requires: php Requires: php-mysql Requires: php-gd Requires: php-ldap Requires: php-pgsql Requires: php-odbc Requires: squid Requires: /usr/bin/wbinfo %description web The %{srcname}-web package provides web administration tool for remotely managing sams2 using your favorite Web browser. %endif ####################################################################### %if 0%{?with_doc} %package doc Summary:SAMS2 Documentation Group:Documentation %description doc The %{srcname}-doc package includes the HTML versions of the "Using SAMS2". %endif ####################################################################### %prep %setup -q -n %{name}-%{version}-rc1 %patch0 -p1 %build make -f Makefile.cvs %configure --disable-static %install %{__rm} -rf %{buildroot} make DESTDIR=%{buildroot} install install -d %{buildroot}%{_initrddir} install -d %{buildroot}%{_sysconfdir}%{apache_confdir} install -d %{buildroot}%{_sysconfdir}/sysconfig install -d %{buildroot}%{_sysconfdir}/logrotate.d install -d %{buildroot}%{_sysconfdir}/%{srcname} install -d %{buildroot}%{_docdir}/%{srcname}-%{version} install -m 644 ChangeLog AUTHORS COPYING NEWS INSTALL %{buildroot}%{_docdir}/%{srcname}-%{version} install -d -m 755 %{buildroot}%{_docdir}/%{srcname}-%{version}/images install -m 755 redhat/init.d %{buildroot}%{_initrddir}/samsd %{__sed} -i -e 's,__PREFIX,%{_prefix}/bin,g' -e 's,__CONFDIR,%{_sysconfdir}/%{srcname},g' %{buildroot}%{_initrddir}/samsd %{__sed} -i 's|/var/lock/subsys/sams2daemon|/var/lock/subsys/samsd|' %{buildroot}%{_initrddir}/samsd %{__sed} -i 's|/var/run/sams2daemon.pid|/var/run/samsd.pid|' %{buildroot}%{_initrddir}/samsd install -m 644 redhat/sysconfig %{buildroot}%{_sysconfdir}/sysconfig/%{srcname} install -m 644 redhat/logrotate %{buildroot}%{_sysconfdir}/logrotate.d/%{name} %__mv -f %{buildroot}%{_libdir}/%{srcname}/* %{buildroot}%{_libdir}/ %__mv -f %{buildroot}%{_sysconfdir}/sams2.conf %{buildroot}%{_sysconfdir}/%{srcname}/ %__chmod 0644 %{buildroot}%{_docdir}/%{srcname}-%{version}/images/freebsd-logo.png %__chmod 0755 %{buildroot}/usr/share/%{srcname}/data %__chmod 0755 %{buildroot}/usr/share/%{srcname}/lang/koi8r* %{__sed} -i 's|SQUIDLOGDIR=/var/log/squid|SQUIDLOGDIR=%{_localstatedir}/log/squid|' %{buildroot}%{_sysconfdir}/%{srcname}/sams2.conf %{__sed} -i 's|^SQUIDCACHEDIR=.*|SQUIDCACHEDIR=%{_localstatedir}/spool/squid|' %{buildroot}%{_sysconfdir}/%{srcname}/sams2.conf %{__sed} -i 's|^SAMSPATH=.*|SAMSPATH=/usr|' %{buildroot}%{_sysconfdir}/%{srcname}/sams2.conf %{__sed} -i 's|^WBINFOPATH=.*|WBINFOPATH=%{_prefix}/bin|' %{buildroot}%{_sysconfdir}/%{srcname}/sams2.conf %{__sed} -i 's|SQUIDGUARDLOGPATH=/var/log|SQUIDGUARDLOGPATH=%{_localstatedir}/log|' %{buildroot}%{_sysconfdir}/%{srcname}/sams2.conf %{__sed} -i 's|SQUIDGUARDDBPATH=/var/db/squidguard|SQUIDGUARDDBPATH=%{_localstatedir}/db/squidguard|' %{buildroot}%{_sysconfdir}/%{srcname}/sams2.conf # let's try to get rid of rpath chrpath --delete %{buildroot}%{_bindir}/{sams2daemon,samsparser,samsredir} %clean %{__rm} -rf %{buildroot} ####################################################################### ## Files section ####################################################################### %files %defattr(-,root,root) %{_prefix}/bin/samsparser %{_prefix}/bin/sams2daemon %{_prefix}/bin/samsredir %{_prefix}/bin/sams_send_email %{_initrddir}/samsd %attr(644,root,root) %config(noreplace) %{_sysconfdir}/sysconfig/%{srcname} %attr(644,root,root) %config(noreplace) %{_sysconfdir}/logrotate.d/%{name} %attr(644,%{webuser},%{squidgroup}) %config(noreplace) %{_sysconfdir}/%{srcname}/sams2.conf %exclude %{_libdir}/* ########## %if 0%{?with_doc} %files doc %defattr(-,root,root) %attr(644,root,root) %config(noreplace) %{_sysconfdir}%{apache_confdir}/doc4sams2.conf %doc %{_docdir}/%{name}2-%{version} %endif ########## %if 0%{?with_web} %files web %defattr(-,%{webuser},%{webgroup}) %attr(644,root,root) %config(noreplace) %{_sysconfdir}%{apache_confdir}/sams2.conf %{_datadir}/%{name}2 %endif ########## %if 0%{?with_devel} %files devel %defattr(-,root,root) %{_libdir}/*.so.* %endif %changelog * Thu Nov 25 2010 Aleksey Popkov - 2.0.0-rc1 - Adding some of sed rules. * Wed Nov 24 2010 Aleksey Popkov - 2.0.0-rc1 - Moved sams2.conf to /_sysconfdir/sams/. * Tue Nov 23 2010 Aleksey Popkov - 2.0.0-rc1 - Fixed some errors. - Adding self package of devel. - Renamed sysconfig and logrotate config files. - Moved lib files from /sams2/* to _libdir macros * Mon Nov 22 2010 Aleksey Popkov - 2.0.0-rc1 - The begin RPM-build speck file for Fedora and CentOs distributives.