forked from pool/squid
Accepting request 482004 from server:proxy:Test
- initialize_cache_if_needed.sh, squid_dir.sed: Initialize cache directory on startup if it is missing. Move scripts out of systemd service file and into individual files. (bnc#1030421) OBS-URL: https://build.opensuse.org/request/show/482004 OBS-URL: https://build.opensuse.org/package/show/server:proxy/squid?expand=0&rev=117
This commit is contained in:
parent
266d569041
commit
a86b838f19
7
cache_dir.sed
Normal file
7
cache_dir.sed
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#!/usr/bin/sed -nf
|
||||||
|
|
||||||
|
/^\s*cache_dir\s\+[[:alnum:]]\+\s\+\([[:graph:]\/]\+\)\s.*/ {
|
||||||
|
s//\1\/00/p
|
||||||
|
q
|
||||||
|
}
|
||||||
|
|
13
initialize_cache_if_needed.sh
Normal file
13
initialize_cache_if_needed.sh
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
DIR=$(dirname $0)
|
||||||
|
CACHE_DIR=$($DIR/cache_dir.sed < /etc/squid/squid.conf)
|
||||||
|
if [ 'x'$CACHE_DIR = 'x' ]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! test -d $CACHE_DIR; then
|
||||||
|
echo "Initializing cache directories..."
|
||||||
|
exec /usr/sbin/squid -z -F -N -S -f /etc/squid/squid.conf
|
||||||
|
fi
|
||||||
|
|
@ -1,3 +1,10 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Wed Mar 22 14:28:05 UTC 2017 - adam.majer@suse.de
|
||||||
|
|
||||||
|
- initialize_cache_if_needed.sh, squid_dir.sed: Initialize cache
|
||||||
|
directory on startup if it is missing. Move scripts out of
|
||||||
|
systemd service file and into individual files. (bnc#1030421)
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Mon Jan 30 09:33:08 UTC 2017 - adam.majer@suse.de
|
Mon Jan 30 09:33:08 UTC 2017 - adam.majer@suse.de
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ After=network.target named.service nss-lookup.service
|
|||||||
[Service]
|
[Service]
|
||||||
Type=forking
|
Type=forking
|
||||||
EnvironmentFile=-/etc/sysconfig/squid
|
EnvironmentFile=-/etc/sysconfig/squid
|
||||||
ExecStartPre=/bin/sh -c "test -d \"`sed -n 's/^cache_dir\s\+[[:alnum:]]\+\s\+\([[:graph:]\/]\+\)\s.*/\1/p' /etc/squid/squid.conf | sed '1 q'`/00\" || /usr/sbin/squid -z -F -N -S -f /etc/squid/squid.conf"
|
ExecStartPre=%{_libdir}/squid/initialize_cache_if_needed.sh
|
||||||
ExecStart=/usr/sbin/squid -F $SQUID_START_OPTIONS -f /etc/squid/squid.conf
|
ExecStart=/usr/sbin/squid -F $SQUID_START_OPTIONS -f /etc/squid/squid.conf
|
||||||
ExecReload=/usr/sbin/squid -F $SQUID_START_OPTIONS -f /etc/squid/squid.conf -k reconfigure
|
ExecReload=/usr/sbin/squid -F $SQUID_START_OPTIONS -f /etc/squid/squid.conf -k reconfigure
|
||||||
ExecStop=/usr/sbin/squid -F -f /etc/squid/squid.conf -k shutdown
|
ExecStop=/usr/sbin/squid -F -f /etc/squid/squid.conf -k shutdown
|
||||||
|
@ -38,6 +38,8 @@ Source10: README.kerberos
|
|||||||
Source11: %{name}.service
|
Source11: %{name}.service
|
||||||
Source13: %{name}.keyring
|
Source13: %{name}.keyring
|
||||||
Source14: squid.init.rh
|
Source14: squid.init.rh
|
||||||
|
Source15: cache_dir.sed
|
||||||
|
Source16: initialize_cache_if_needed.sh
|
||||||
|
|
||||||
# do not show some rpmlint warnings
|
# do not show some rpmlint warnings
|
||||||
Source99: squid-rpmlintrc
|
Source99: squid-rpmlintrc
|
||||||
@ -259,6 +261,9 @@ fdupes -q -n -r %{buildroot}%{_prefix}
|
|||||||
# systemd vs SysVinit
|
# systemd vs SysVinit
|
||||||
%if 0%{?has_systemd}
|
%if 0%{?has_systemd}
|
||||||
install -D -m 644 %{SOURCE11} %{buildroot}%{_unitdir}/%{name}.service
|
install -D -m 644 %{SOURCE11} %{buildroot}%{_unitdir}/%{name}.service
|
||||||
|
install -D -m 755 %{SOURCE15} %{buildroot}%{squidlibdir}/cache_dir.sed
|
||||||
|
install -D -m 755 %{SOURCE16} %{buildroot}%{squidlibdir}/initialize_cache_if_needed.sh
|
||||||
|
sed -i -e 's!%%{_libdir}!%{_libdir}!' %{buildroot}%{_unitdir}/%{name}.service
|
||||||
ln -sf %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}
|
ln -sf %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}
|
||||||
%else # SysVinit
|
%else # SysVinit
|
||||||
# fix postrotate script for SysVinit
|
# fix postrotate script for SysVinit
|
||||||
@ -406,6 +411,8 @@ end
|
|||||||
%doc %{_mandir}/man?/*
|
%doc %{_mandir}/man?/*
|
||||||
%if 0%{?has_systemd}
|
%if 0%{?has_systemd}
|
||||||
%{_unitdir}/%{name}.service
|
%{_unitdir}/%{name}.service
|
||||||
|
%{squidlibdir}/initialize_cache_if_needed.sh
|
||||||
|
%{squidlibdir}/cache_dir.sed
|
||||||
%else
|
%else
|
||||||
%{_sysconfdir}/init.d/%{name}
|
%{_sysconfdir}/init.d/%{name}
|
||||||
%endif
|
%endif
|
||||||
|
Loading…
Reference in New Issue
Block a user