ported from sysv5 to systemd [release 0.5.10-2mamba;Sat Apr 22 2023]

This commit is contained in:
Silvan Calarco 2024-01-05 21:03:05 +01:00
parent 1a40870206
commit 7540e1d7a1
7 changed files with 62 additions and 121 deletions

View File

@ -1,77 +0,0 @@
#!/bin/sh
#
# chkconfig: 345 92 34
# description: Starts and stops the c-icap server
#
# pidfile: /var/run/c-icap/c-icap.pid
# config: /etc/c-icap.conf
# source function library
. /etc/sysconfig/rc
. $rc_functions
NAME=c-icap
DAEMON=/usr/bin/$NAME
DAEMONPID=/var/run/c-icap/$NAME.pid
DAEMONCONF=/etc/c-icap.conf
OPTIONS=""
[ -x $DAEMON ] || exit 0
# source networking configuration
. /etc/sysconfig/network
# check that networking is up
[ ${NETWORKING} = "no" ] && exit 0
# avoid using root's TMPDIR
unset TMPDIR
[ -r /etc/sysconfig/$NAME ] && . /etc/sysconfig/$NAME
# check that smb.conf exists
[ -r $DAEMONCONF ] || exit 0
RETVAL=0
case "$1" in
start)
echo -n $"Starting $NAME: "
daemon --pidfile=$DAEMONPID $DAEMON $OPTIONS
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$NAME
;;
stop)
echo -n $"Stopping $NAME: "
killproc -p $DAEMONPID $DAEMON
# Workaround: force stop of all processes
killall -9 $DAEMON
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$NAME $DAEMONPID
;;
restart|force-reload)
$0 stop
sleep 1
$0 start
;;
reload)
echo -n "Reloading $NAME: "
reloadproc $DAEMON
echo
;;
condrestart)
[ -e /var/lock/subsys/$NAME ] && $0 restart || :
;;
status)
statusproc $DAEMON
RETVAL=$?
;;
*)
echo $"Usage: ""/etc/init.d/$NAME {start|stop|status|reload|restart|condrestart}"
exit 1
;;
esac
exit $?

View File

@ -1,13 +0,0 @@
/var/log/c_icap/*.log {
compress
dateext
maxage 365
rotate 99
missingok
notifempty
size=+2096k
create 600 vscan root
postrotate
/etc/init.d/c-icap reload
endscript
}

9
c-icap.logrotate Normal file
View File

@ -0,0 +1,9 @@
/var/log/c-icap/*.log {
create 600 proxy proxy
sharedscripts
missingok
notifempty
postrotate
/bin/kill -HUP `cat /run/c-icap/c-icap.pid 2>/dev/null` 2> /dev/null || true
endscript
}

11
c-icap.service Normal file
View File

@ -0,0 +1,11 @@
[Unit]
Description=ICAP server implementation
[Service]
User=proxy
Type=forking
PIDFile=/run/c-icap/c-icap.pid
ExecStart=/usr/bin/c-icap
[Install]
WantedBy=multi-user.target

View File

@ -1,16 +1,18 @@
%define majver %(echo %version | cut -d. -f 1-2) %define majver %(echo %version | cut -d. -f 1-2)
Name: c-icap Name: c-icap
Version: 0.5.10 Version: 0.5.10
Release: 1mamba Release: 2mamba
Summary: An implementation of an ICAP server that can be used with HTTP proxies like Squid Summary: An implementation of an ICAP server that can be used with HTTP proxies like Squid
Group: System/Servers Group: System/Servers
Vendor: openmamba Vendor: openmamba
Distribution: openmamba Distribution: openmamba
Packager: Silvan Calarco <silvan.calarco@mambasoft.it> Packager: Silvan Calarco <silvan.calarco@mambasoft.it>
URL: http://c-icap.sourceforge.net URL: https://c-icap.sourceforge.net/
Source: https://sourceforge.net/projects/c-icap/files/c-icap/%{majver}.x/c_icap-%{version}.tar.gz Source: https://sourceforge.net/projects/c-icap/files/c-icap/%{majver}.x/c_icap-%{version}.tar.gz
Source1: %{name}-initscript Source1: c-icap.service
Source2: %{name}-logrotate Source2: c-icap.logrotate
Source3: c-icap.sysusers
Source4: c-icap.tmpfiles
Patch0: %{name}-0.1.5-conf.patch Patch0: %{name}-0.1.5-conf.patch
License: LGPL License: LGPL
## AUTOBUILDREQ-BEGIN ## AUTOBUILDREQ-BEGIN
@ -38,8 +40,7 @@ Requires: libicapapi-devel = %{?epoch:%epoch:}%{version}-%{release}
%description devel %description devel
c-icap is an implementation of an ICAP server. It can be used with HTTP proxies that support the ICAP protocol such as the Squid 3.x HTTP proxy server to implement content adaptation/filtering services. c-icap is an implementation of an ICAP server. It can be used with HTTP proxies that support the ICAP protocol such as the Squid 3.x HTTP proxy server to implement content adaptation/filtering services.
This package contains static libraries and header files needed for c-icap development.
This package contains static libraries and header files need for c-icap development.
%package -n libicapapi %package -n libicapapi
Summary: Library used by %{name} Summary: Library used by %{name}
@ -64,57 +65,61 @@ This package contains static libraries and header files needed for development.
#%patch0 -p1 #%patch0 -p1
%build %build
%configure %configure \
make c-icap.conf --sysconfdir=%{_sysconfdir}/c-icap \
--enable-ipv6
#make c-icap.conf
%make %make
%install %install
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" [ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
%makeinstall %makeinstall
install -D -m 0755 %{SOURCE1} %{buildroot}%{_initrddir}/c-icap install -D -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}/c-icap.service
install -D -m 0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/logrotate.d/c-icap install -D -m 0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/logrotate.d/c-icap
install -D -m 0644 %{SOURCE3} %{buildroot}%{_sysusersdir}/c-icap.conf
install -D -m 0644 %{SOURCE4} %{buildroot}%{_tmpfilesdir}/c-icap.conf
install -d %{buildroot}/var/log/c-icap install -d %{buildroot}/var/log/c-icap
%clean %clean
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" [ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
%pre
%sysusers_create_package c-icap %{SOURCE3}
%tmpfiles_create_package c-icap %{SOURCE4}
:
%post %post
if [ $1 -eq 1 ]; then %systemd_post c-icap.service
#new install :
chkconfig --add c-icap
fi
%preun %preun
if [ $1 -eq 0 ]; then %systemd_preun c-icap.service
#erase :
%{_initrddir}/c-icap stop
chkconfig --del c-icap
fi
%postun %postun
if [ $1 -eq 1 ]; then %systemd_postun_with_restart c-icap.service
#upgrade :
%{_initrddir}/c-icap restart
fi
%post -n libicapapi -p /sbin/ldconfig %post -n libicapapi -p /sbin/ldconfig
%postun -n libicapapi -p /sbin/ldconfig %postun -n libicapapi -p /sbin/ldconfig
%files %files
%defattr(-,root,root) %defattr(-,root,root)
%config(noreplace) %{_sysconfdir}/c-icap.conf %dir %{_sysconfdir}/c-icap
%{_sysconfdir}/c-icap.conf.default %config(noreplace) %{_sysconfdir}/c-icap/c-icap.conf
%config(noreplace) %{_sysconfdir}/c-icap.magic %{_sysconfdir}/c-icap/c-icap.conf.default
%{_sysconfdir}/c-icap.magic.default %config(noreplace) %{_sysconfdir}/c-icap/c-icap.magic
%{_sysconfdir}/c-icap/c-icap.magic.default
%config(noreplace) %{_sysconfdir}/logrotate.d/c-icap %config(noreplace) %{_sysconfdir}/logrotate.d/c-icap
%{_initrddir}/c-icap
%{_bindir}/c-icap %{_bindir}/c-icap
%{_bindir}/c-icap-client %{_bindir}/c-icap-client
%{_bindir}/c-icap-mkbdb %{_bindir}/c-icap-mkbdb
%{_bindir}/c-icap-stretch %{_bindir}/c-icap-stretch
%attr(750,squid,squid) %dir /var/run/c-icap %{_unitdir}/c-icap.service
%attr(750,squid,squid) %dir /var/log/c-icap %{_sysusersdir}/c-icap.conf
%{_tmpfilesdir}/c-icap.conf
%{_mandir}/man8/c-icap-client.8* %{_mandir}/man8/c-icap-client.8*
%{_mandir}/man8/c-icap-mkbdb.8* %{_mandir}/man8/c-icap-mkbdb.8*
%{_mandir}/man8/c-icap-stretch.8* %{_mandir}/man8/c-icap-stretch.8*
@ -130,7 +135,7 @@ fi
%{_libdir}/libicapapi.so.* %{_libdir}/libicapapi.so.*
%dir %{_libdir}/c_icap %dir %{_libdir}/c_icap
%{_libdir}/c_icap/* %{_libdir}/c_icap/*
%doc AUTHORS COPYING README TODO %doc AUTHORS COPYING
%files -n libicapapi-devel %files -n libicapapi-devel
%defattr(-,root,root) %defattr(-,root,root)
@ -138,10 +143,13 @@ fi
%dir %{_includedir}/c_icap %dir %{_includedir}/c_icap
%{_includedir}/c_icap/*.h %{_includedir}/c_icap/*.h
%{_libdir}/libicapapi.so %{_libdir}/libicapapi.so
%{_libdir}/libicapapi.la
%{_mandir}/man8/c-icap-libicapapi-config.8* %{_mandir}/man8/c-icap-libicapapi-config.8*
%doc README TODO
%changelog %changelog
* Sat Apr 22 2023 Silvan Calarco <silvan.calarco@mambasoft.it> 0.5.10-2mamba
- ported from sysv5 to systemd
* Sat Oct 23 2021 Automatic Build System <autodist@mambasoft.it> 0.5.10-1mamba * Sat Oct 23 2021 Automatic Build System <autodist@mambasoft.it> 0.5.10-1mamba
- automatic version update by autodist - automatic version update by autodist

1
c-icap.sysusers Normal file
View File

@ -0,0 +1 @@
u proxy 15 - /var/empty

2
c-icap.tmpfiles Normal file
View File

@ -0,0 +1,2 @@
d /run/c-icap 0755 proxy proxy -
d /var/log/c-icap 0750 proxy proxy -