From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.sysutils.supervision.general/1285 Path: news.gmane.org!not-for-mail From: j.schlick@decagon.de Newsgroups: gmane.comp.sysutils.supervision.general Subject: runit spec file for Fedora Core XX Date: Sun, 29 Oct 2006 20:13:46 +0100 Message-ID: <4544FD6A.5070903@decagon.de> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------020905010208030100060104" X-Trace: sea.gmane.org 1162149222 30465 80.91.229.2 (29 Oct 2006 19:13:42 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 29 Oct 2006 19:13:42 +0000 (UTC) Original-X-From: supervision-return-1521-gcsg-supervision=m.gmane.org@list.skarnet.org Sun Oct 29 20:13:37 2006 Return-path: Envelope-to: gcsg-supervision@gmane.org Original-Received: from antah.skarnet.org ([212.85.147.14]) by ciao.gmane.org with smtp (Exim 4.43) id 1GeG64-0004EE-OS for gcsg-supervision@gmane.org; Sun, 29 Oct 2006 20:13:29 +0100 Original-Received: (qmail 11694 invoked by uid 76); 29 Oct 2006 19:13:48 -0000 Mailing-List: contact supervision-help@list.skarnet.org; run by ezmlm List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Archive: Original-Received: (qmail 11688 invoked from network); 29 Oct 2006 19:13:48 -0000 User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9a1) Gecko/20060919 SeaMonkey/1.5a Original-To: supervision@list.skarnet.org Xref: news.gmane.org gmane.comp.sysutils.supervision.general:1285 Archived-At: This is a multi-part message in MIME format. --------------020905010208030100060104 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Hi, I've created a RPM Spec-File for RedHat/Fedora Core 6. - it uses dietlibc to create the binaries. - it uses the default sysv init scheme and adds/removes automatically the runit lines to the /etc/inittab file. Perhaps there is someone who likes it or feel free to add it to the runit package. best regards -- ================================================= Jochen Schlick mailto: j.schlick_at_decagon.de ================================================= --------------020905010208030100060104 Content-Type: text/plain; name="runit.spec" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="runit.spec" %define name runit %define version 1.7.0 %define release 5.diet.js %define mybindir /sbin # default directories %define servicedir /var/service %define servicelogdir /var/log/svlog %define servicescriptdir %{_sysconfdir}/sv %define noShell /sbin/nologin %define nofilesGrp 2108 %define multilogUsr 7800 #.............................................................................. Summary: Gerrit Pape's UN*X init scheme with service supervision Name: %{name} Version: %{version} Release: %{release} License: BSD Group: System Environment/Daemons/DJB URL: http://smarden.org/runit/ Source0: %{name}-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Requires: sed BuildRequires: dietlibc #.............................................................................. %description runit is a daemontools alike replacement for SysV-init and other init schemes. It currently runs on GNU/Linux, OpenBSD, FreeBSD, and can easily be adapted to other Unix operating systems. runit implements a simple three-stage concept. Stage 1 performs the system's one-time initialization tasks. Stage 2 starts the system's uptime services (via the runsvdir program). Stage 3 handles the tasks necessary to shutdown and halt or reboot. This feature isn't used by this RPM. We use runit's service supervision without replacing the init scheme of the system. We simply run the stage 2 of runit as a service with your current init. This is done by adding an entry for %{mybindir}/runsvdir-start to /etc/inittab. servicedir %{servicedir} servicescriptdir %{servicescriptdir} servicelogdir %{servicelogdir} NOTE: the runit tools will be placed in %{mybindir} %prep %setup -n admin -q ( cd %{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 ) #.............................................................................. %build ( cd %{name}-%{version} echo "$RPM_BUILD_ROOT/" > src/conf-home ./package/compile ./package/check ) #.............................................................................. %install rm -rf $RPM_BUILD_ROOT install -d %{buildroot}%{mybindir} install -d %{buildroot}%{_mandir}/man8 (cd %{name}-%{version} # runit script, replace servicedir and PATH cat etc/debian/2 | \ sed 's@/var/service@%{servicedir}@g' | \ sed 's@^PATH=.*@PATH=/bin:/sbin:/usr/bin:/usr/sbin@' > %{buildroot}%{mybindir}/runsvdir-start # executables cp command/* %{buildroot}%{mybindir}/ # manual install of the manpages cp man/*.8 %{buildroot}%{_mandir}/man8/ ) # service directories %{__install} -dDp -m0755 %{buildroot}%{servicedir} %{__install} -dDp -m0755 %{buildroot}%{servicelogdir} %{__install} -dDp -m0755 %{buildroot}%{servicescriptdir} #.............................................................................. %pre # only update if [ "$1" = "2" ]; then echo "removing old runit entries in /etc/inittab" sed -e '/^# runit/d' /etc/inittab.new && mv /etc/inittab /etc/inittab.old && mv /etc/inittab.new /etc/inittab sed -e '/^RS:123456:respawn:\/sbin\/runsvd/d' /etc/inittab.new && mv /etc/inittab /etc/inittab.old && mv /etc/inittab.new /etc/inittab fi # Add user and groups if necessary %{_sbindir}/groupadd -g %{nofilesGrp} nofiles 2>/dev/null %{_sbindir}/useradd -d %{servicelogdir} -s %{noShell} -M -g nofiles -u %{multilogUsr} multilog 2>/dev/null exit 0 #.............................................................................. %post # always add inittab entries echo "appending new runit entries in /etc/inittab" echo "# runit automatically added -------------------------------------------- BEGIN" >> /etc/inittab echo "RS:123456:respawn:/sbin/runsvdir-start /dev/console 2>/dev/console" >> /etc/inittab echo "# runit automatically added ---------------------------------------------- END" >> /etc/inittab # send a HUP to the init process for reloading inittab kill -HUP 1 #.............................................................................. %preun # only deinstall if [ "$1" = "0" ]; then echo "removing obsolete runit entries in /etc/inittab" sed -e '/^# runit/d' /etc/inittab.new && mv /etc/inittab /etc/inittab.old && mv /etc/inittab.new /etc/inittab sed -e '/^RS:123456:respawn:\/sbin\/runsvd/d' /etc/inittab.new && mv /etc/inittab /etc/inittab.old && mv /etc/inittab.new /etc/inittab # send a HUP to the init process for reloading inittab kill -HUP 1 fi #........................................................................ %postun # only deinstall (so not upgraded): if [ $1 = 0 ]; then # this is needed for user* and group* programs export PATH=$PATH:/usr/sbin echo "Removing runit users (if they exist):" function user_del() { if id -u $1 >/dev/null 2> /dev/null ; then echo " Removing $1 user ..." userdel $1 fi } for i in multilog; do user_del $i done ## update nis database if /sbin/pidof ypserv >/dev/null 2>/dev/null; then (cd /var/yp; make) fi echo "" echo "Removing runit groups (if they exist):" function group_del() { if groupmod $1 >/dev/null 2> /dev/null; then echo " Removing $1 group ..." groupdel $1 fi } for i in nofiles; do group_del $i done ## update nis database if /sbin/pidof ypserv >/dev/null 2>/dev/null; then (cd /var/yp; make) fi fi exit 0 #.............................................................................. %clean rm -rf $RPM_BUILD_ROOT #.............................................................................. %files %defattr(-,root,root) %doc %{name}-%{version}/package/CHANGES %doc %{name}-%{version}/package/README %doc %{name}-%{version}/package/THANKS %doc %{name}-%{version}/doc/* %doc %{name}-%{version}/etc/2 %doc %{name}-%{version}/etc/debian/* %attr(0755,root,root) %{mybindir}/* %doc %{_mandir}/man8/* %dir %{servicedir} %dir %{servicescriptdir} %attr(0755,multilog,nofiles) %dir %{servicelogdir} #.............................................................................. %changelog * Wed Oct 25 2006 Jochen Schlick 1.7.0-5.diet.js - avoid inittab conflicts with daemontools - using sed to create runsvdir-start * Tue Oct 24 2006 Jochen Schlick 1.7.0-4.diet.js - missing man pages added * Tue Oct 24 2006 Jochen Schlick 1.7.0-2.diet.js - bugfix * Sat Oct 14 2006 Jochen Schlick 1.7.0-1.diet.js - initial version --------------020905010208030100060104--