diff --git a/c-icap-initscript b/c-icap-initscript deleted file mode 100644 index 6621286..0000000 --- a/c-icap-initscript +++ /dev/null @@ -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 $? diff --git a/c-icap-logrotate b/c-icap-logrotate deleted file mode 100644 index 970ef19..0000000 --- a/c-icap-logrotate +++ /dev/null @@ -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 -} diff --git a/c-icap.logrotate b/c-icap.logrotate new file mode 100644 index 0000000..e84f475 --- /dev/null +++ b/c-icap.logrotate @@ -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 +} diff --git a/c-icap.service b/c-icap.service new file mode 100644 index 0000000..419892d --- /dev/null +++ b/c-icap.service @@ -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 diff --git a/c-icap.spec b/c-icap.spec index 72c4bad..0ccb00e 100644 --- a/c-icap.spec +++ b/c-icap.spec @@ -1,16 +1,18 @@ %define majver %(echo %version | cut -d. -f 1-2) Name: c-icap Version: 0.5.10 -Release: 1mamba +Release: 2mamba Summary: An implementation of an ICAP server that can be used with HTTP proxies like Squid Group: System/Servers Vendor: openmamba Distribution: openmamba Packager: Silvan Calarco -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 -Source1: %{name}-initscript -Source2: %{name}-logrotate +Source1: c-icap.service +Source2: c-icap.logrotate +Source3: c-icap.sysusers +Source4: c-icap.tmpfiles Patch0: %{name}-0.1.5-conf.patch License: LGPL ## AUTOBUILDREQ-BEGIN @@ -38,8 +40,7 @@ Requires: libicapapi-devel = %{?epoch:%epoch:}%{version}-%{release} %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. - -This package contains static libraries and header files need for c-icap development. +This package contains static libraries and header files needed for c-icap development. %package -n libicapapi Summary: Library used by %{name} @@ -64,57 +65,61 @@ This package contains static libraries and header files needed for development. #%patch0 -p1 %build -%configure -make c-icap.conf +%configure \ + --sysconfdir=%{_sysconfdir}/c-icap \ + --enable-ipv6 + +#make c-icap.conf %make %install [ "%{buildroot}" != / ] && rm -rf "%{buildroot}" %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 %{SOURCE3} %{buildroot}%{_sysusersdir}/c-icap.conf +install -D -m 0644 %{SOURCE4} %{buildroot}%{_tmpfilesdir}/c-icap.conf install -d %{buildroot}/var/log/c-icap %clean [ "%{buildroot}" != / ] && rm -rf "%{buildroot}" +%pre +%sysusers_create_package c-icap %{SOURCE3} +%tmpfiles_create_package c-icap %{SOURCE4} +: + %post -if [ $1 -eq 1 ]; then -#new install - chkconfig --add c-icap -fi +%systemd_post c-icap.service +: %preun -if [ $1 -eq 0 ]; then -#erase - %{_initrddir}/c-icap stop - chkconfig --del c-icap -fi +%systemd_preun c-icap.service +: %postun -if [ $1 -eq 1 ]; then -#upgrade - %{_initrddir}/c-icap restart -fi +%systemd_postun_with_restart c-icap.service +: %post -n libicapapi -p /sbin/ldconfig %postun -n libicapapi -p /sbin/ldconfig %files %defattr(-,root,root) -%config(noreplace) %{_sysconfdir}/c-icap.conf -%{_sysconfdir}/c-icap.conf.default -%config(noreplace) %{_sysconfdir}/c-icap.magic -%{_sysconfdir}/c-icap.magic.default +%dir %{_sysconfdir}/c-icap +%config(noreplace) %{_sysconfdir}/c-icap/c-icap.conf +%{_sysconfdir}/c-icap/c-icap.conf.default +%config(noreplace) %{_sysconfdir}/c-icap/c-icap.magic +%{_sysconfdir}/c-icap/c-icap.magic.default %config(noreplace) %{_sysconfdir}/logrotate.d/c-icap -%{_initrddir}/c-icap %{_bindir}/c-icap %{_bindir}/c-icap-client %{_bindir}/c-icap-mkbdb %{_bindir}/c-icap-stretch -%attr(750,squid,squid) %dir /var/run/c-icap -%attr(750,squid,squid) %dir /var/log/c-icap +%{_unitdir}/c-icap.service +%{_sysusersdir}/c-icap.conf +%{_tmpfilesdir}/c-icap.conf %{_mandir}/man8/c-icap-client.8* %{_mandir}/man8/c-icap-mkbdb.8* %{_mandir}/man8/c-icap-stretch.8* @@ -130,7 +135,7 @@ fi %{_libdir}/libicapapi.so.* %dir %{_libdir}/c_icap %{_libdir}/c_icap/* -%doc AUTHORS COPYING README TODO +%doc AUTHORS COPYING %files -n libicapapi-devel %defattr(-,root,root) @@ -138,10 +143,13 @@ fi %dir %{_includedir}/c_icap %{_includedir}/c_icap/*.h %{_libdir}/libicapapi.so -%{_libdir}/libicapapi.la %{_mandir}/man8/c-icap-libicapapi-config.8* +%doc README TODO %changelog +* Sat Apr 22 2023 Silvan Calarco 0.5.10-2mamba +- ported from sysv5 to systemd + * Sat Oct 23 2021 Automatic Build System 0.5.10-1mamba - automatic version update by autodist diff --git a/c-icap.sysusers b/c-icap.sysusers new file mode 100644 index 0000000..95121e6 --- /dev/null +++ b/c-icap.sysusers @@ -0,0 +1 @@ +u proxy 15 - /var/empty diff --git a/c-icap.tmpfiles b/c-icap.tmpfiles new file mode 100644 index 0000000..c1ed800 --- /dev/null +++ b/c-icap.tmpfiles @@ -0,0 +1,2 @@ +d /run/c-icap 0755 proxy proxy - +d /var/log/c-icap 0750 proxy proxy -