You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

140 lines
4.7 KiB

##
## squidguard.spec -- OpenPKG RPM Package Specification
## Copyright (c) 2000-2020 OpenPKG Project <http://openpkg.org/>
##
## Permission to use, copy, modify, and distribute this software for
## any purpose with or without fee is hereby granted, provided that
## the above copyright notice and this permission notice appear in all
## copies.
##
## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
## SUCH DAMAGE.
##
# package version
%define V_dist 1.5-beta
%define V_opkg 1.5beta
# package information
Name: squidguard
Summary: Squid Proxy Access Control
URL: http://www.squidguard.org/
Vendor: Shalla Secure Services
Packager: OpenPKG Project
Distribution: OpenPKG Community
Class: EVAL
Group: Web
License: GPL
Version: %{V_opkg}
Release: 20100910
# list of sources
Source0: http://www.squidguard.org/Downloads/Devel/squidGuard-%{V_dist}.tar.gz
Source1: rc.squidguard
Source2: squidguard-update
Source3: squidguard.conf
Patch0: squidguard.patch
# build information
BuildPreReq: OpenPKG, openpkg >= 20160101, bison, flex
PreReq: OpenPKG, openpkg >= 20160101
BuildPreReq: db
PreReq: db
%description
SquidGuard is an URL redirector used to use blacklists with the web
proxy Squid.
%track
prog squidguard = {
version = %{V_dist}
url = http://www.squidguard.org/Downloads/Devel/
regex = squidGuard-(__VER__)\.tar\.gz
}
%prep
%setup -q -n squidGuard-%{V_dist}
%patch -p0
%build
# configure program
CC="%{l_cc}" \
CFLAGS="%{l_cflags -O}" \
CPPFLAGS="%{l_cppflags}" \
LDFLAGS="%{l_ldflags}" \
./configure \
--prefix=%{l_prefix} \
--with-db=%{l_prefix} \
--with-db-lib=%{l_prefix}/lib \
--with-db-inc=%{l_prefix}/include \
--with-sg-config=%{l_prefix}/etc/squidguard/squidguard.conf \
--with-sg-logdir=%{l_prefix}/var/squidguard/log \
--with-sg-dbhome=%{l_prefix}/var/squidguard/db
# build program
%{l_make} %{l_mflags -O}
%install
# create installation hierarchy
%{l_shtool} mkdir -f -p -m 755 \
$RPM_BUILD_ROOT%{l_prefix}/bin \
$RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
$RPM_BUILD_ROOT%{l_prefix}/etc/squidguard \
$RPM_BUILD_ROOT%{l_prefix}/var/squidguard/log \
$RPM_BUILD_ROOT%{l_prefix}/var/squidguard/db
# install programs
%{l_shtool} install -c -s -m 755 \
src/squidGuard $RPM_BUILD_ROOT%{l_prefix}/bin/squidguard
%{l_shtool} install -c -m 755 %{l_value -s -a} \
-e 's;@l_bash@;%{l_bash};g' \
-e 's;@l_shtool@;%{l_shtool};g' \
-e 's;@l_gzip@;%{l_gzip};g' \
-e 's;@l_tar@;%{l_tar};g' \
%{SOURCE squidguard-update} $RPM_BUILD_ROOT%{l_prefix}/bin/
# install default configuration
%{l_shtool} install -c -m 644 %{l_value -s -a} \
%{SOURCE squidguard.conf} $RPM_BUILD_ROOT%{l_prefix}/etc/squidguard/
# install run-command script
%{l_shtool} install -c -m 755 %{l_value -s -a} \
%{SOURCE rc.squidguard} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
# determine installation files
%{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
%{l_files_std} \
'%config %{l_prefix}/etc/squidguard/squidguard.conf' \
'%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/etc/squidguard/*' \
'%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/squidguard/*'
%files -f files
%clean
%post
if [ $1 -eq 1 ]; then
# display information about next step
( echo "To use SquidGuard you have to configure Squid accordingly:"
echo "redirect_program $RPM_INSTALL_PREFIX/bin/squidguard"
) | %{l_rpmtool} msg -b -t notice
fi
exit 0
%preun
# before erase, stop service and remove log files
[ $1 -eq 0 ] || exit 0
rm -rf $RPM_INSTALL_PREFIX/var/squidguard/db/* >/dev/null 2>&1 || true
rm -f $RPM_INSTALL_PREFIX/var/squidguard/log/* >/dev/null 2>&1 || true
exit 0