daemontools-encore/daemontools-encore.spec

125 lines
3.7 KiB
RPMSpec
Raw Normal View History

2025-01-16 05:49:20 +01:00
Summary: A collection of tools for managing UNIX services
Name: daemontools-encore
Version: 1.10
Release: 3%{org_tag}%{dist}
License: Public domain
Group: Utilities/System
URL: http://untroubled.org/daemontools-encore/
Source: http://untroubled.org/daemontools-encore/%{name}-%{version}.tar.gz
Source2: daemontools-svscanboot
Source3: daemontools.service
Buildroot: %_tmppath/%{name}-%{version}
Obsoletes: daemontools
Provides: daemontools
BuildRequires: /usr/bin/perl
2025-01-16 05:08:08 +01:00
%description
2025-01-16 05:49:20 +01:00
daemontools-encore is a collection of tools for managing UNIX services.
It is derived from the public-domain release of daemontools by D. J.
Bernstein, which can be found at http://cr.yp.to/daemontools.html
2025-01-16 05:08:08 +01:00
2025-01-16 05:49:20 +01:00
daemontools-encore adds numerous enhancements above what daemontools
could do while maintaining backwards compatibility with daemontools.
See the CHANGES file for more details on what features have been added.
2025-01-16 05:08:08 +01:00
2025-01-16 05:49:20 +01:00
I realize there are other supervisory systems that will handle some or
all of the tasks that this package does better. I am providing this
package as a service to those who prefer the semantics and handling that
daemontools provides.
2025-01-16 05:08:08 +01:00
2025-01-16 05:49:20 +01:00
%prep
%setup
perl -i -pe 'if ($. == 1) { s!^!%{buildroot}!; s!local/!! }' conf-bin
perl -i -pe 'if ($. == 1) { s!^!%{buildroot}!; s!local!share! }' conf-man
2025-01-16 05:08:08 +01:00
%build
2025-01-16 05:49:20 +01:00
make
2025-01-16 05:08:08 +01:00
%install
2025-01-16 05:49:20 +01:00
mkdir -p %{buildroot}%{_bindir}
mkdir -p %{buildroot}%{_mandir}
DESTDIR=%{buildroot} make install
%if %{rhel} >= 7
mkdir -p %{buildroot}/usr/lib/systemd/system
install -m 0644 %{SOURCE3} %{buildroot}/usr/lib/systemd/system
%endif
%if %{rhel} == 6
mkdir -p %{buildroot}%{_sysconfdir}/init
install -m 0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/init/svscanboot.conf
%endif
mkdir -p %{buildroot}/service
2025-01-16 05:08:08 +01:00
%post
2025-01-16 05:49:20 +01:00
%if %{rhel} >= 7
if [ -e /usr/bin/systemctl ] ; then
systemctl enable daemontools
systemctl start daemontools
fi
%endif
%if %{rhel} == 6
/sbin/initctl start svscanboot || true
%endif
%if %{rhel} < 6
# Add svscanboot to inittab
if [ ! -f /etc/inittab ]; then
echo "No /etc/inittab found - required svscanboot line not added!"
exit 1
elif grep svscanboot /etc/inittab >/dev/null; then
echo "svscanboot line found in /etc/inittab - I assume svscan is already running"
else
rm -f /etc/inittab.rpmnew
cp /etc/inittab /etc/inittab.rpmnew || exit 1
echo >> /etc/inittab.rpmnew
echo '# Start daemontools svscan' >> /etc/inittab.rpmnew
echo 'SV:123456:respawn:/usr/bin/svscanboot' >> /etc/inittab.rpmnew
mv -f /etc/inittab.rpmnew /etc/inittab
kill -HUP 1
echo "Added svscanboot to /etc/inittab - init should start svscan now."
fi
%endif
# symink executables to legacy SME directory
for prog in envdir envuidgid fghack multilog pgrphack readproctitle setlock setuidgid softlimit supervise svc svok svscan svscanboot svstat ; do
ln -s /bin/$prog /usr/local/bin/$prog
done
2025-01-16 05:08:08 +01:00
%postun
2025-01-16 05:49:20 +01:00
if [ "$1" -eq 0 ]; then
%if %{rhel} >= 7
systemctl stop daemontools
systemctl disable daemontools
%endif
%if %{rhel} == 6
/sbin/initctl stop svscanboot
%endif
%if %{rhel} < 6
# Remove svscanboot entry from inittab
if grep svscanboot /etc/inittab >/dev/null; then
grep -v svscan /etc/inittab > /etc/inittab.rpmnew
mv -f /etc/inittab.rpmnew /etc/inittab
kill -HUP 1
echo "Removed svscanboot from /etc/inittab."
fi
%endif
fi
%files
2025-01-16 05:08:08 +01:00
%defattr(-,root,root)
2025-01-16 05:49:20 +01:00
%attr(0755,root,root) /usr/bin/*
/usr/share/man/man8/*
%if %{rhel} >= 7
/usr/lib/systemd/system/daemontools.service
%endif
%if %{rhel} == 6
%{_sysconfdir}/init/*conf
%endif
%dir %attr(0755,root,root) /service
%doc README CHANGES CHANGES.djb LICENSE TODO
%changelog
* Thu Jan 16 2025 Trevor Batley <trevorb@koozali.org> 1.10-3
- check that systemctl exists in post install
- symlink executables to legacy sme directory
* Wed Feb 04 2015 Gavin Carr <gavin@openfusion.com.au> 1.10-1
- Initial package.