runit

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit 56b94280ba2002c552120ea7da173cb766039986
parent e809d3102e33eaf685c634a562eae309fa702d16
Author: Gerrit Pape <pape@smarden.org>
Date:   Mon,  7 Oct 2002 09:29:38 +0000

0.7.0.

Diffstat:
MMakefile | 2+-
Mdebian/changelog | 4++--
Mdebian/postinst | 2+-
Mdebian/rules | 38+++++++++++++++++++-------------------
Mdoc/install.html | 10+++++-----
Mdoc/replaceinit.html | 4++--
Mdoc/runlevels.html | 15++++++++++++++-
Mdoc/upgrade.html | 33+++++++++++++++++++++++++++++++++
Mpackage/CHANGES | 4++--
Mpackage/upgrade | 4++--
Msrc/runsvchdir.c | 29+++++++++++++++++++++--------
11 files changed, 102 insertions(+), 43 deletions(-)

diff --git a/Makefile b/Makefile @@ -1,6 +1,6 @@ DESTDIR= -PACKAGE=runit-0.6.4 +PACKAGE=runit-0.7.0 DIRS=doc man etc package src MANPAGES=runit.8 runit-init.8 runsvdir.8 runsv.8 svwaitdown.8 svwaitup.8 \ utmpset.8 runsvchdir.8 diff --git a/debian/changelog b/debian/changelog @@ -1,10 +1,10 @@ -runit (0.6.4-1) sarge; urgency=low +runit (0.7.0-1) sarge; urgency=low * See /package/admin/runit/package/CHANGES. * preinst: new; create hardlink /sbin/runit.old -> /sbin/runit on upgrade. - -- Gerrit Pape <pape@smarden.org> Sun, 6 Oct 2002 12:24:15 +0200 + -- Gerrit Pape <pape@smarden.org> Mon, 7 Oct 2002 11:25:47 +0200 runit (0.6.0-1) sarge; urgency=low diff --git a/debian/postinst b/debian/postinst @@ -25,7 +25,7 @@ set -e case "$1" in configure) ( \ - cd /package/admin/runit-0.6.4 + cd /package/admin/runit-0.7.0 package/upgrade ) ;; diff --git a/debian/rules b/debian/rules @@ -23,15 +23,15 @@ build-stamp: # $(MAKE) #/usr/bin/docbook-to-man debian/runit.sgml > runit.1 - tar xfzvp runit-0.6.4.tar.gz + tar xfzvp runit-0.7.0.tar.gz ( \ - cd admin/runit-0.6.4 ; \ + cd admin/runit-0.7.0 ; \ echo 'diet gcc -O2 -Wall' > src/conf-cc ; \ echo 'diet gcc -s -Os -pipe' > src/conf-ld ; \ package/compile ; \ - echo "/package/admin/runit-0.6.4" > compile/home ; \ + echo "/package/admin/runit-0.7.0" > compile/home ; \ rm -f compile/src ; \ - ln -s /package/admin/runit-0.6.4/src compile/src ; \ + ln -s /package/admin/runit-0.7.0/src compile/src ; \ ) touch build-stamp @@ -58,40 +58,40 @@ install: build chmod 1755 debian/runit/package cp -a admin debian/runit/package/ - rm -rf debian/runit/package/admin/runit-0.6.4/compile - cp -a debian/runit/package/admin/runit-0.6.4/man . - rm -rf debian/runit/package/admin/runit-0.6.4/man - cp -a debian/runit/package/admin/runit-0.6.4/doc . - rm -rf debian/runit/package/admin/runit-0.6.4/doc - cp -a debian/runit/package/admin/runit-0.6.4/etc . - rm -rf debian/runit/package/admin/runit-0.6.4/etc - cp -a debian/runit/package/admin/runit-0.6.4/package . + rm -rf debian/runit/package/admin/runit-0.7.0/compile + cp -a debian/runit/package/admin/runit-0.7.0/man . + rm -rf debian/runit/package/admin/runit-0.7.0/man + cp -a debian/runit/package/admin/runit-0.7.0/doc . + rm -rf debian/runit/package/admin/runit-0.7.0/doc + cp -a debian/runit/package/admin/runit-0.7.0/etc . + rm -rf debian/runit/package/admin/runit-0.7.0/etc + cp -a debian/runit/package/admin/runit-0.7.0/package . # /etc/runit - cp -p admin/runit-0.6.4/etc/debian/[123] \ + cp -p admin/runit-0.7.0/etc/debian/[123] \ debian/runit/etc/runit/ - cp -p admin/runit-0.6.4/etc/debian/ctrlaltdel \ + cp -p admin/runit-0.7.0/etc/debian/ctrlaltdel \ debian/runit/etc/runit/ - cp -p admin/runit-0.6.4/etc/debian/getty-tty5/run \ + cp -p admin/runit-0.7.0/etc/debian/getty-tty5/run \ debian/runit/etc/runit/getty-5/run # runit programs - cp -p debian/runit/package/admin/runit-0.6.4/command/runit* \ + cp -p debian/runit/package/admin/runit-0.7.0/command/runit* \ debian/runit/sbin/ # cleanup - rm -rf debian/runit/package/admin/runit-0.6.4/compile + rm -rf debian/runit/package/admin/runit-0.7.0/compile # create debian/links rm -f debian/links for i in \ - `cat debian/runit/package/admin/runit-0.6.4/package/commands` ; \ + `cat debian/runit/package/admin/runit-0.7.0/package/commands` ; \ do \ echo "/package/admin/runit/command/$$i /command/$$i" \ >> debian/links ; \ done for i in \ - `cat debian/runit/package/admin/runit-0.6.4/package/commands` ; \ + `cat debian/runit/package/admin/runit-0.7.0/package/commands` ; \ do \ echo "/command/$$i /usr/local/bin/$$i" \ >> debian/links ; \ diff --git a/doc/install.html b/doc/install.html @@ -13,14 +13,14 @@ Check that you have the recent version of <a href="http://cr.yp.to/daemontools.html">daemontools</a> installed. <p> Download -<a href="runit-0.6.4.tar.gz">runit-0.6.4.tar.gz</a> into <tt>/package</tt> +<a href="runit-0.7.0.tar.gz">runit-0.7.0.tar.gz</a> into <tt>/package</tt> and unpack the archive <pre> # cd /package - # gunzip runit-0.6.4.tar - # tar -xpf runit-0.6.4.tar - # rm runit-0.6.4.tar - # cd admin/runit-0.6.4 + # gunzip runit-0.7.0.tar + # tar -xpf runit-0.7.0.tar + # rm runit-0.7.0.tar + # cd admin/runit-0.7.0 </pre> Compile and install the <i>runit</i> programs <pre> diff --git a/doc/replaceinit.html b/doc/replaceinit.html @@ -107,7 +107,7 @@ default Unix process no 1 <i>runit</i>. </pre> To report success: <pre> - # ( uname -a ; cat /etc/runit/[123] ) | mail pape-runit-0.6.4@smarden.org + # ( uname -a ; cat /etc/runit/[123] ) | mail pape-runit-0.7.0@smarden.org </pre> <hr> @@ -188,7 +188,7 @@ Use <b>init 6</b> to reboot and <b>init 0</b> to halt a system that runs <p> To report success: <pre> - # ( uname -a ; cat /etc/runit/[123] ) | mail pape-runit-0.6.4@smarden.org + # ( uname -a ; cat /etc/runit/[123] ) | mail pape-runit-0.7.0@smarden.org </pre> <h3>Step 5: Service migration</h3> The goal is to migrate all services from <i>/etc/rc.*</i> scheme to the diff --git a/doc/runlevels.html b/doc/runlevels.html @@ -27,12 +27,25 @@ Create the following direcotories and symlinks: Copy the content of <tt>/service/</tt> to <tt>/etc/runit/runsvdir/current</tt> and replace <tt>/service</tt> with a symlink: <pre> - # cp -pr /service/* /etc/runit/runsvdir/current/ + # cp -pR /service/* /etc/runit/runsvdir/current/ # mv -f /service /service.old && ln -s /etc/runit/runsvdir/current /service </pre> You have now created two runlevels: <tt>default</tt> and <tt>single</tt>. The <tt>current</tt> runlevel is <tt>default</tt>. It is save to remove <tt>/service.old</tt> if you don't need it anymore. +<p> +Finally edit <tt>/etc/runit/2</tt> to set the <tt>default</tt> runlevel when +stage 2 starts: +<pre> + $ cat /etc/runit/2 + #!/bin/sh + PATH=/command:/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin + + <b>runsvchdir default &gt;/dev/null</b> + + exec env - PATH=$PATH \ + runsvdir /service 'log: ...........................................................................................................................................................................................................................................................................................................................................................................................................' +</pre> <hr> <a name="switch"><h3>Switching runlevels</h3></a> Switching runlevels with <i>runit</i> is done by diff --git a/doc/upgrade.html b/doc/upgrade.html @@ -10,6 +10,39 @@ <h1>runit - upgrading from previous versions</h1> <hr> +<h3>0.6.0 to 0.7.0</h3> +This version introduces runlevel support with the new +<a href="runsvchdir.8.html">runsvchdir</a> program. See the +<a href="runlevels.html">runlevels documentation</a> for more information. +<p> +The <a href="runsvdir.8.html">runsvdir</a> and +<a href="runsv.8.html">runsv</a> programs have changed and should be +restarted. If you want to switch runlevels, <tt>runsvdir</tt> must be +restarted. This is done on the next reboot or by following these steps: +<p> +<ul> + <li> +Login on console 5. Bring all services other than the <tt>getty-5</tt> +service down: +<pre> + # cd /service + # for i in *; do if test "$i" != getty-5; then svc -d $i; fi; done +</pre> + <li> +Check for the services being down: +<pre> + # svstat /service/* +</pre> + <li> +If all services other than the <tt>getty-5</tt> service are down, kill +<tt>runsvdir</tt> by sending it a HUP signal: +<pre> + # kill -HUP &lt;pid_of_runsvdir&gt; +</pre> +Replace <tt>&lt;pid_of_runsvdir&gt;</tt> with the pid of <tt>runsvdir</tt>. +The <tt>runit</tt> program starts the new <tt>runsvdir</tt> program now, +which starts the new <tt>runsv</tt> processes. +</ul> <h3>0.5.0 to 0.6.0</h3> There are two new programs, <a href="runsvdir.8.html">runsvdir</a> and <a href="runsv.8.html">runsv</a>, which replace the diff --git a/package/CHANGES b/package/CHANGES @@ -1,5 +1,5 @@ -runit 0.6.4 -Sun, 06 Oct 2002 12:23:56 +0200 +runit 0.7.0 +Mon, 07 Oct 2002 11:26:27 +0200 * runsvdir.c: check service directory's inode and device in addition to mtime; sleep at least 1 second before restarting run svprocesses. * runsv.c: use status[19] for state information; control pipe supports e. diff --git a/package/upgrade b/package/upgrade @@ -7,9 +7,9 @@ test -d src || ( echo 'Wrong working directory.'; exit 1 ) here=`env - PATH=$PATH pwd` parent=`dirname $here` -echo 'Creating symlink runit -> runit-0.6.4...' +echo 'Creating symlink runit -> runit-0.7.0...' rm -f runit -ln -s runit-0.6.4 runit +ln -s runit-0.7.0 runit mv -f runit .. echo 'Making command links in /command...' diff --git a/src/runsvchdir.c b/src/runsvchdir.c @@ -6,9 +6,10 @@ #include "error.h" #define USAGE " dir" - #define SVDIR "/etc/runit/runsvdir" +#define VERSION "$Id" + char *progname; char *new; @@ -21,6 +22,9 @@ void fatal(char *m1, char *m2) { void fatalx(char *m1, char *m2) { strerr_die4x(111, progname, ": fatal: ", m1, m2); } +void warn(char *m1, char *m2) { + strerr_warn5(progname, ": fatal: ", m1, m2, ": ", &strerr_sys); +} int main (int argc, char **argv) { struct stat s; @@ -47,8 +51,12 @@ int main (int argc, char **argv) { dev =s.st_dev; if (stat("current", &s) == -1) fatal("unable to stat: ", "current"); - if ((s.st_ino == ino) && (s.st_dev == dev)) - strerr_die2x(0, new, ": already current."); + if ((s.st_ino == ino) && (s.st_dev == dev)) { + buffer_puts(buffer_1, "runsvchdir: "); + buffer_puts(buffer_1, new); + buffer_putsflush(buffer_1, ": current.\n"); + exit(0); + } if (unlink("current.new") == -1) if (errno != error_noent) @@ -58,11 +66,16 @@ int main (int argc, char **argv) { if (unlink("previous") == -1) if (errno != error_noent) fatal("unable to unlink: ", "previous"); - if (link("current", "previous") == -1) + if (rename("current", "previous") == -1) fatal("unable to copy: current to ", "previous"); - if (rename("current.new", "current") == -1) - fatal("unabled to move: current.new to ", "current"); - - strerr_die2x(0, new, ": now current."); + if (rename("current.new", "current") == -1) { + warn("unable to move: current.new to ", "current"); + if (rename("previous", "current") == -1) + fatal("unable to move previous back to ", "current"); + exit(111); + } + buffer_puts(buffer_1, "runsvchdir: "); + buffer_puts(buffer_1, new); + buffer_putsflush(buffer_1, ": now current.\n"); exit(0); }