- removed grep dependency, substituted with awk

- quote bash variables, so it supports spaces
- polish squid.spec and remove obsolet commands
This commit is contained in:
Lubos Uhliarik 2020-03-26 10:19:34 +01:00
parent ca868d658e
commit c684998ac2
2 changed files with 8 additions and 7 deletions

View File

@ -5,7 +5,8 @@ fi
SQUID_CONF=${SQUID_CONF:-"/etc/squid/squid.conf"} SQUID_CONF=${SQUID_CONF:-"/etc/squid/squid.conf"}
CACHE_SWAP=`grep '^[[:blank:]]*cache_dir' $SQUID_CONF | awk '{ print $3 }'` CACHE_SWAP=`awk '/^[[:blank:]]*cache_dir/ { print $3 }' "$SQUID_CONF"`
init_cache_dirs=0 init_cache_dirs=0
for adir in $CACHE_SWAP; do for adir in $CACHE_SWAP; do
@ -17,5 +18,5 @@ done
if [ $init_cache_dirs -ne 0 ]; then if [ $init_cache_dirs -ne 0 ]; then
echo "" echo ""
squid --foreground -z -f $SQUID_CONF >> /var/log/squid/squid.out 2>&1 squid --foreground -z -f "$SQUID_CONF" >> /var/log/squid/squid.out 2>&1
fi fi

View File

@ -2,7 +2,7 @@
Name: squid Name: squid
Version: 4.10 Version: 4.10
Release: 3%{?dist} Release: 4%{?dist}
Summary: The Squid proxy caching server Summary: The Squid proxy caching server
Epoch: 7 Epoch: 7
# See CREDITS for breakdown of non GPLv2+ code # See CREDITS for breakdown of non GPLv2+ code
@ -35,7 +35,7 @@ Patch204: squid-3.5.9-include-guards.patch
Patch205: squid-4.0.21-large-acl.patch Patch205: squid-4.0.21-large-acl.patch
# cache_swap.sh # cache_swap.sh
Requires: bash grep gawk Requires: bash gawk
# for httpd conf file - cachemgr script alias # for httpd conf file - cachemgr script alias
Requires: httpd-filesystem Requires: httpd-filesystem
Requires(pre): shadow-utils Requires(pre): shadow-utils
@ -195,8 +195,6 @@ mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/log/squid
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/spool/squid mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/spool/squid
mkdir -p $RPM_BUILD_ROOT/run/squid mkdir -p $RPM_BUILD_ROOT/run/squid
chmod 644 contrib/url-normalizer.pl contrib/user-agents.pl chmod 644 contrib/url-normalizer.pl contrib/user-agents.pl
iconv -f ISO88591 -t UTF8 ChangeLog -o ChangeLog.tmp
mv -f ChangeLog.tmp ChangeLog
# install /usr/lib/tmpfiles.d/squid.conf # install /usr/lib/tmpfiles.d/squid.conf
mkdir -p ${RPM_BUILD_ROOT}%{_tmpfilesdir} mkdir -p ${RPM_BUILD_ROOT}%{_tmpfilesdir}
@ -214,7 +212,6 @@ mv $RPM_BUILD_ROOT/usr/share/squid/mib.txt $RPM_BUILD_ROOT/usr/share/snmp/mibs/S
rm -f $RPM_BUILD_ROOT%{_sysconfdir}/squid/squid.conf.documented rm -f $RPM_BUILD_ROOT%{_sysconfdir}/squid/squid.conf.documented
# remove unpackaged files from the buildroot # remove unpackaged files from the buildroot
rm -f $RPM_BUILD_ROOT%{_bindir}/{RunAccel,RunCache}
rm -f $RPM_BUILD_ROOT/squid.httpd.tmp rm -f $RPM_BUILD_ROOT/squid.httpd.tmp
%files %files
@ -295,6 +292,9 @@ fi
%changelog %changelog
* Thu Mar 26 2020 Lubos Uhliarik <luhliari@redhat.com> - 7:4.10-4
- Resolves: #1817208 - More cache_swap.sh optimizations
* Wed Mar 25 2020 Lubos Uhliarik <luhliari@redhat.com> - 7:4.10-3 * Wed Mar 25 2020 Lubos Uhliarik <luhliari@redhat.com> - 7:4.10-3
- Resolves: #1786485 - squid.service: use ${SQUID_CONF} rather than $SQUID_CONF - Resolves: #1786485 - squid.service: use ${SQUID_CONF} rather than $SQUID_CONF
- Resolves: #1798535 - CVE-2019-12528 squid: Information Disclosure issue in - Resolves: #1798535 - CVE-2019-12528 squid: Information Disclosure issue in