systemd service support [release 3.5.22-2mamba;Sun Oct 23 2016]

This commit is contained in:
Silvan Calarco 2024-01-05 18:05:28 +01:00
parent 26662fbccd
commit d51e1eaa7b
3 changed files with 66 additions and 44 deletions

View File

@ -3,14 +3,4 @@
#
# Options passed to Squid.
SQUID_OPTIONS="-s"
# Set to 1 to automatically restart squid after failure.
#SQUID_RESPAWN=1
# Time to wait for Squid to shut down when asked.
SQUID_SHUTDOWN_TIMEOUT=100
# The maximum number of file descriptors Squid will run with (max 8128).
#SQUID_MAXFD=4096
SQUID_OPTIONS="-sYC"

21
squid.service Normal file
View File

@ -0,0 +1,21 @@
## Copyright (C) 1996-2016 The Squid Software Foundation and contributors
##
## Squid software is distributed under GPLv2+ license and includes
## contributions from numerous individuals and organizations.
## Please see the COPYING and CONTRIBUTORS files for details.
##
[Unit]
Description=Squid Web Proxy Server
After=network.target
[Service]
Type=simple
EnvironmentFile=-/etc/sysconfig/squid
ExecStartPre=/usr/sbin/squid -z
ExecStart=/usr/sbin/squid -N $SQUID_OPTIONS
ExecStop=/usr/sbin/squid -k shutdown
ExecReload=/usr/sbin/squid -k reconfigure
[Install]
WantedBy=multi-user.target

View File

@ -5,7 +5,7 @@
Name: squid
Version: 3.5.22
Release: 1mamba
Release: 2mamba
Summary: The Squid proxy caching server
Group: System/Servers
Vendor: openmamba
@ -18,26 +18,37 @@ Source2: %{name}-logrotate
Source3: %{name}-pamd
Source4: %{name}-sysconfig
Source5: %{name}-conf
Source6: %{name}.service
Patch: %{name}-3.0.STABLE15-default_config.patch
Patch1: %{name}-3.0.STABLE13-gcc44.patch
# patches from: http://www.squid-cache.org/Versions/v2/2.5/bugs/
License: GPL
## AUTOBUILDREQ-BEGIN
BuildRequires: glibc-devel
BuildRequires: libbsd-devel
BuildRequires: libcap-devel
BuildRequires: libe2fs-devel
BuildRequires: libgcc
BuildRequires: libgnutls-devel
BuildRequires: libkrb5-devel
BuildRequires: libltdl-devel
BuildRequires: libnetfilter_conntrack-devel
BuildRequires: libnettle-devel
BuildRequires: libopenldap-devel
BuildRequires: libopenssl-devel
BuildRequires: libsasl-devel
BuildRequires: libpam-devel
BuildRequires: libperl
BuildRequires: libsasl2-devel
BuildRequires: libstdc++6-devel
BuildRequires: libwww-devel
BuildRequires: libz-devel
BuildRequires: pam-devel
BuildRequires: perl-devel
BuildRequires: perl-Authen-Smb
BuildRequires: perl-DBI
BuildRequires: perl-URI
BuildRequires: perl-devel
## AUTOBUILDREQ-END
BuildRequires: openjade
BuildRequires: linuxdoc-tools
Obsoletes: squid-respawn
%systemd_requires
BuildRoot: %{_tmppath}/%{name}-%{version}-root
%description
@ -63,6 +74,9 @@ sed -i "s|-Werror||" configure
--libexecdir=%{_libdir}/squid \
--sysconfdir=%{_sysconfdir}/squid \
--datadir=%{_datadir}/squid \
--with-logdir=%{_localstatedir}/log/squid \
--with-swapdir=%{_localstatedir}/spool/squid \
--runstatedir=/run \
--with-default-user=squid \
--enable-delay-pools \
--enable-snmp \
@ -101,11 +115,13 @@ sed -i "s|-Werror||" configure
bindir=%{_sbindir} \
sysconfdir=%{_sysconfdir}/squid
install -m755 -D %{S:1} %{buildroot}%{_initrddir}/squid
install -D -m0644 %{SOURCE6} %{buildroot}%{_unitdir}/squid.service
#install -m755 -D %{S:1} %{buildroot}%{_initrddir}/squid
install -m644 -D %{S:2} %{buildroot}%{_sysconfdir}/logrotate.d/squid
install -m644 -D %{S:3} %{buildroot}%{_sysconfdir}/pam.d/squid
install -m644 -D %{S:4} %{buildroot}%{_sysconfdir}/sysconfig/squid
install -m640 -D %{S:5} %{buildroot}%{_sysconfdir}/squid/squid.conf
install -m640 -D %{buildroot}%{_sysconfdir}/squid/squid.conf.default %{buildroot}%{_sysconfdir}/squid/squid.conf
install -d %{buildroot}%{_var}/log/squid
install -d %{buildroot}%{_var}/spool/squid
@ -132,35 +148,26 @@ rm -f %{buildroot}%{_sbindir}/RunCache
-s /bin/false squid 2>/dev/null
exit 0
#%post
#if [ $1 -eq 1 ]; then
# [ -r /etc/sysconfig/rc ] && . /etc/sysconfig/rc || exit 1
# [ -r "$rc_networkfunctions" ] && . $rc_networkfunctions || exit 1
#
# get_interfaces_by_zone
# get_interface_parameters "$ifzone_local"
# if [ -n "$int_network" -a -n "$int_netmask" ]; then
# sed -i "s|\(acl lan src\).*|\1 $int_network/$int_netmask|" \
# %{_sysconfdir}/squid/squid.conf
# fi
#fi
#exit 0
%post
%systemd_post %{name}
:
%preun
%systemd_preun %{name}
# erase
if [ $1 -eq 0 ]; then
service squid stop
/sbin/chkconfig --del squid
/usr/sbin/userdel squid
fi
exit 0
:
%postun
#update
if [ $1 -eq 1 ]; then
service squid condrestart
fi
exit 0
%systemd_postun_with_restart %{name}
:
%posttrans
# clean old sysv broken links
find /etc/rc[0-6].d/ -type l -xtype l -exec rm -f {} \;
:
%files
%defattr(-,root,root)
@ -178,7 +185,8 @@ exit 0
%{_sbindir}/purge
%{_sbindir}/squid
%{_sbindir}/squidclient
%{_initrddir}/squid
%{_unitdir}/squid.service
#%{_initrddir}/squid
%{_datadir}/squid/errors/*
%{_datadir}/squid/icons/*
%{_datadir}/snmp/mibs/SQUID-MIB.txt
@ -227,11 +235,14 @@ exit 0
%dir %attr(0755,squid,squid) %{_var}/spool/squid
%{_mandir}/man1/squidclient.1.gz
%{_mandir}/man8/*
%doc ChangeLog CONTRIBUTORS COPYING CREDITS
%doc QUICKSTART README RELEASENOTES.html SPONSORS
%doc contrib/url-normalizer.pl contrib/rredir.* contrib/user-agents.pl
%doc CONTRIBUTORS COPYING CREDITS
#%doc ChangeLog
#%doc QUICKSTART README RELEASENOTES.html SPONSORS
%changelog
* Sun Oct 23 2016 Silvan Calarco <silvan.calarco@mambasoft.it> 3.5.22-2mamba
- systemd service support
* Mon Oct 10 2016 Automatic Build System <autodist@mambasoft.it> 3.5.22-1mamba
- automatic version update by autodist