initial commit of file from CVS for runit on Fri 14 Jul 16:17:44 BST 2023

This commit is contained in:
Brian Read 2023-07-14 16:17:44 +01:00
parent 77f8cf2a18
commit 646288e223
11 changed files with 303 additions and 1 deletions

1
.gitattributes vendored Normal file
View File

@ -0,0 +1 @@
*.tar.gz filter=lfs diff=lfs merge=lfs -text

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
*.rpm
*.log
*spec-20*

21
Makefile Normal file
View File

@ -0,0 +1,21 @@
# Makefile for source rpm: runit
# $Id: Makefile,v 1.1 2016/02/07 21:09:42 stephdl Exp $
NAME := runit
SPECFILE = $(firstword $(wildcard *.spec))
define find-makefile-common
for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done
endef
MAKEFILE_COMMON := $(shell $(find-makefile-common))
ifeq ($(MAKEFILE_COMMON),)
# attept a checkout
define checkout-makefile-common
test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2
endef
MAKEFILE_COMMON := $(shell $(checkout-makefile-common))
endif
include $(MAKEFILE_COMMON)

View File

@ -1,3 +1,11 @@
# runit # runit
3rd Party (Maintained by Koozali) git repo for runit smeserver 3rd Party (Maintained by Koozali) git repo for runit smeserver
## Description
<br />*This description has been generated by an LLM AI system and cannot be relied on to be fully correct.*
*Once it has been checked, then this comment will be deleted*
<br />
Runit is a software package that provides a framework for running and monitoring Unix services. It works with System V-style init, as well as some BSD-style init systems, and is designed to be easy to use and highly reliable. It supervises individual services and ensures that they are always running. When the service fails, runit automatically restarts it and sends an alert.

1
contriborbase Normal file
View File

@ -0,0 +1 @@
sme10

BIN
runit-2.1.2.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

54
runit.dependencies.README Normal file
View File

@ -0,0 +1,54 @@
After some messing about, I've finished my dependency system for runit,
and am now using it to start up and shut down my machine. =)
I've hacked about on svwaitup and svwaitdown a little; the diff is
enclosed and is required to make the dependencies work. Summary of
changes:
* svwaitup has an option to retry (with a variable delay) if the
supervisor is not running or the service is not requested to be up.
This was needed as the dependencies are brought up in background
processes for parallelism, so the parent has to wait.
* svwaitdown has an option not to send the down command to services
(still defaults to doing so). This is needed for the inverse situation
of the above. =)
You need the previous patch I posted as well which creates the tools
svisup and svisdown.
The actual dependency management is done by having links in
servicedir/updeps that point to services which must be up first. The
reverse dependencies can be automatically generated by the enclosed
script svdepcalc, though at the moment it's really stupid and doesn't do
any kind of checking for cycles..etc.
Once the dependency links are there, svup and svdown will bring services
up and down in a way which obeys all dependency rules. The way I use it:
* All services are in a single directory; no pseudo-runlevels or
anything
* All services have a 'down' file to stop them starting.
* The /etc/runit/1 script runs svup in the background on a dummy service
which depends on everything I want to run (apache..etc).
* runsvdir starts and brings up the supervisors, and as it does so, svup
brings services up.
Once the machine is up you can use svup and svdown freely to start and
stop services in a way which follows the dependencies. Then, to shut
down:
* /etc/runit/3 runs 'for SRV in /service/*; do svdown $SRV; done' which
brings services down in line with dependencies. At least, if they
terminate properly. There is a timeout for services that don't. (they
are not killed at this stage)
* /etc/runit/3 runs svwaitdown -kx with a short timeout to clean up any
services which did not get terminated cleanly by the above
* Halt.
I make few promises about the actual correct functioning of these
scripts and strongly recommend that you have a good read of them (in
fact, it'd be nice if you did that anyway to give me some feedback).
They work for me on exactly one machine, and have been tested a bit on
some fake services as well, but that's not a *lot* of testing.. =)
Thanks in advance for any comments, and I hope that at least someone
finds this useful =)
Torne

141
runit.spec Normal file
View File

@ -0,0 +1,141 @@
# $Id: runit.spec,v 1.1 2016/02/07 21:09:42 stephdl Exp $
Summary: a UNIX init scheme with service supervision
Name: runit
Version: 2.1.2
Release: 1%{?dist}
License: BSD style
Group: System Enviornment/Daemons
Url: http://smarden.org/runit/
Source: %{name}-%{version}.tar.gz
Source1: runit.svup
Source2: runit.svdown
Source3: runit.svdepcalc
Source4: runit.dependencies.README
BuildRequires: dietlibc
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}.root
%description
runit is a daemontools alike replacement for sysvinit and other init
schemes. runit runs on GNU/Linux, OpenBSD, FreeBSD, and can easily be
adapted to other unix operating systems. If runit runs for you on any
other operating system or Linux distribution, please let me know.
Warning: Replacing sysvinit or init can cause the system's boot to
fail. Make sure you are able to recover and repair your system, for
example if you run a boot loader, it should be able to pass init=/bin/sh
to the kernel.
%changelog
* Fri Jul 14 2023 BogusDateBot
- Eliminated rpmbuild "bogus date" warnings due to inconsistent weekday,
by assuming the date is correct and changing the weekday.
* Sun Feb 7 2016 stephane de labrusse <stephdl@de-labrusse.fr> 2.1.2-1
- Build new rpm for sme10
* Tue Nov 11 2014 Daniel Berteaud <daniel@firewall-services.com> - 2.1.2-1
- Update to 2.1.2 [SME: 8655]
* Mon Oct 6 2008 Shad L. Lords <slords@mail.com>
- Update to 2.0.0 [SME: 4628]
* Sun Apr 29 2007 Shad L. Lords <slords@mail.com>
- Clean up spec so package can be built by koji/plague
* Fri Feb 16 2007 Shad L. Lords <slords@mail.com>
- Update to 1.7.2
* Thu Dec 07 2006 Shad L. Lords <slords@mail.com>
- Update to new release naming. No functional changes.
- Make Packager generic
* Thu Nov 09 2006 Charlie Brady <charlie_brady@mitel.com> 1.7.1-01
- Update to 1.7.1
* Wed Nov 01 2006 Charlie Brady <charlie_brady@mitel.com> 1.7.0-02
- Build with dietlibc
* Wed Nov 01 2006 Charlie Brady <charlie_brady@mitel.com> 1.7.0-01
- Update to 1.7.0
* Thu Jun 29 2006 Charlie Brady <charlie_brady@mitel.com> 1.6.0-01
- Update to 1.6.0
* Sun May 28 2006 Charlie Brady <charlie_brady@mitel.com> 1.5.1-01
- Update to 1.5.1
* Fri Feb 03 2006 Charlie Brady <charlie_brady@mitel.com> 1.3.3-01
- Update to 1.3.3
* Wed Aug 31 2005 Charlie Brady <charlieb@e-smith.com> 1.3.1-01
- Update to 1.3.1.
* Sun Jan 16 2005 Charlie Brady <charlieb@e-smith.com> 1.2.1-01
- Update to 1.2.1.
* Mon Dec 20 2004 Charlie Brady <charlieb@e-smith.com> 1.2.0-01
- Update to 1.2.0.
* Thu Sep 23 2004 Charlie Brady <charlieb@e-smith.com> 1.0.5-01
- Update to 1.0.5.
* Tue May 11 2004 Charlie Brady <charlieb@e-smith.com> 1.0.2-01
- Update to 1.0.2.
- Do not build against uCLibc.
* Tue Nov 04 2003 Charlie Brady <charlieb@e-smith.com> 0.12.0-01
- Update to rev 0.12.0 (which includes the isup/isdown patch).
* Wed Oct 29 2003 Charlie Brady <charlieb@e-smith.com> 0.11.2-02
- Add dependency management and isupdown patches from Torne Wuff
<torne-runit@wolfpuppy.org.uk>.
- Build against uClibc.
- Add missing man pages.
* Thu Oct 02 2003 Charlie Brady <charlieb@e-smith.com> 0.11.2-01
- Upgrade to version 0.11.2.
* Fri Jul 18 2003 Charlie Brady <charlieb@e-smith.com> 0.10-01
- Upgrade to version 0.10.0. Drop references to dietlibc (which wasn't
actually used, but appears to have an incompatible license).
* Wed Jun 18 2003 Charlie Brady <charlieb@e-smith.com> 0.95-01
- Initial
%prep
%setup -c -n %{name}-%{version}
%build
cd admin/%{name}-%{version}
#Change the conf-cc and conf-ld to use diet
echo 'diet -Os gcc -O2 -Wall' >src/conf-cc
echo 'diet -Os gcc -s -Os -pipe' >src/conf-ld
./package/compile
%install
cd admin/%{name}-%{version}
mkdir -p $RPM_BUILD_ROOT/%{_bindir}
install %{SOURCE1} command/svisup
install %{SOURCE2} command/svisdown
install %{SOURCE3} command/svdepcalc
install %{SOURCE4} doc/dependencies.README
for i in $(cat package/commands) svisup svisdown svdepcalc
do
install command/$i $RPM_BUILD_ROOT/%{_bindir}
done
#mkdir -p $RPM_BUILD_ROOT/%{_mandir}/man1
#install man/*.1 $RPM_BUILD_ROOT/%{_mandir}/man1
mkdir -p $RPM_BUILD_ROOT/%{_mandir}/man8
install man/*.8 $RPM_BUILD_ROOT/%{_mandir}/man8
%clean
rm -r $RPM_BUILD_ROOT
%files
%defattr(-,root,root)
%{_bindir}/*
%doc %{_mandir}/man8/*
#%{_mandir}/man1/*
%doc admin/%{name}-%{version}/package/COPYING
%doc admin/%{name}-%{version}/doc/*

17
runit.svdepcalc Normal file
View File

@ -0,0 +1,17 @@
#!/bin/sh
if [ ! -d $1 ]; then
echo "Usage: svdepcalc /path/to/your/service/directory"
exit 111
fi
cd $1
for DIR in *; do rm -rf $DIR/downdeps; done
for DIR in *; do
if [ -d $DIR/updeps ]; then
for DEP in $DIR/updeps/*; do
mkdir -p $DEP/downdeps
ln -s `pwd`/$DIR $DEP/downdeps
done
fi
done

24
runit.svdown Normal file
View File

@ -0,0 +1,24 @@
#!/bin/sh
[ -z $SV_TIMEOUT ] && export SV_TIMEOUT=300
# Check if this service is already down; avoids useless recursion
svisdown $1 && exit 0
if [ -d $1/downdeps ]; then
# We have dependencies to check
for DEPENDENCY in $1/downdeps/*; do
# start svdown in background so they will run in parallel
svdown $DEPENDENCY &
done
# Wait for all services to be down
svwaitdown -n -t $SV_TIMEOUT $1/downdeps/* || exit 111
fi
# actually stop the service
svc -d $1 || exit 111
exit 0

29
runit.svup Normal file
View File

@ -0,0 +1,29 @@
#!/bin/sh
[ -z $SV_RETRYTIME ] && SV_RETRYTIME=1
[ -z $SV_WAITTIME ] && SV_WAITTIME=1
# Check if this service is already up; avoids useless recursion
svisup $1 && exit 0
if [ -d $1/updeps ]; then
# We have dependencies to check
for DEPENDENCY in $1/updeps/*; do
# start svup in background so they will run in parallel
svup $DEPENDENCY &
done
# Wait for all services to be up
svwaitup -r $SV_RETRYTIME -s $SV_WAITTIME $1/updeps/* || exit 111
fi
# Ensure that a supervisor is running for this service
# this is postponed to here in order to get more parallelism on boot =)
until svok $1; do sleep $SV_RETRYTIME; done
# actually start the service
svc -u $1 || exit 111
exit 0