summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--Makefile5
-rw-r--r--debian/changelog5
-rw-r--r--debian/postinst2
-rwxr-xr-xdebian/rules51
-rw-r--r--doc/index.html24
-rw-r--r--doc/install.html10
-rw-r--r--doc/replaceinit.html4
-rw-r--r--doc/utmpset.html52
-rwxr-xr-xetc/debian/getty-tty5/run.utmpset3
-rw-r--r--package/CHANGES6
-rwxr-xr-xpackage/upgrade4
-rw-r--r--src/Makefile6
-rw-r--r--src/utmpset.c18
13 files changed, 137 insertions, 53 deletions
diff --git a/Makefile b/Makefile
index 8b7ca51..1707d3e 100644
--- a/Makefile
+++ b/Makefile
@@ -1,11 +1,10 @@
 DESTDIR=
 
-PACKAGE=runit-0.3.3
+PACKAGE=runit-0.4.0
 DIRS=doc man etc package src
 MANPAGES=man/runit.8 man/runit-init.8 man/svwaitdown.8 man/svwaitup.8
-DAEMONTOOLS_PD=daemontools-pd-0.76
 
-all: clean .manpages $(DAEMONTOOLS_PD).tar.gz $(PACKAGE).tar.gz
+all: clean .manpages $(PACKAGE).tar.gz
 
 .manpages:
 	for i in $(MANPAGES); do \
diff --git a/debian/changelog b/debian/changelog
index d8d0c4d..95a4b91 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,8 +1,9 @@
-runit (0.3.3-1) woody; urgency=low
+runit (0.4.0-1) woody; urgency=low
 
   * See /package/admin/runit/package/CHANGES.
+  * build and install the utmpset program.
 
- -- Gerrit Pape <pape@smarden.org>  Sat, 18 May 2002 19:26:51 +0200
+ -- Gerrit Pape <pape@smarden.org>  Sun, 19 May 2002 12:31:09 +0200
 
 runit (0.3.2-2) woody; urgency=low
 
diff --git a/debian/postinst b/debian/postinst
index 0836697..5bdb94d 100644
--- a/debian/postinst
+++ b/debian/postinst
@@ -25,7 +25,7 @@ set -e
 case "$1" in
     configure)
 	( \
-	cd /package/admin/runit-0.3.3
+	cd /package/admin/runit-0.4.0
 	package/upgrade
 	)
     ;;
diff --git a/debian/rules b/debian/rules
index b6000f0..a7a217d 100755
--- a/debian/rules
+++ b/debian/rules
@@ -23,18 +23,19 @@ build-stamp:
 	#	$(MAKE)
 	#/usr/bin/docbook-to-man debian/runit.sgml > runit.1
 
-	tar xfzvp runit-0.3.3.tar.gz
+	tar xfzvp runit-0.4.0.tar.gz
 	( \
-	cd admin/runit-0.3.3/src ; \
-	echo 'diet gcc -O2 -Wall' > conf-cc ; \
-	echo 'diet gcc -s -Os -pipe' > conf-ld ; \
-	)
-	( \
-	cd admin/runit-0.3.3 ; \
+	cd admin/runit-0.4.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.3.3" > compile/home ; \
+	echo 'gcc -O2 -Wall' > src/conf-cc ; \
+	echo 'gcc -s' > src/conf-ld ; \
+	( cd compile ; make utmpset ) ; \
+	echo "/package/admin/runit-0.4.0" > compile/home ; \
 	rm -f compile/src ; \
-	ln -s /package/admin/runit-0.3.3/src compile/src ; \
+	ln -s /package/admin/runit-0.4.0/src compile/src ; \
+	install -m0755 compile/utmpset command/utmpset ; \
 	)
 	touch build-stamp
 
@@ -61,40 +62,40 @@ install: build
 
 	chmod 1755 debian/runit/package
 	cp -a admin debian/runit/package/
-	rm -rf debian/runit/package/admin/runit-0.3.3/compile
-	cp -a debian/runit/package/admin/runit-0.3.3/man .
-	rm -rf debian/runit/package/admin/runit-0.3.3/man
-	cp -a debian/runit/package/admin/runit-0.3.3/doc .
-	rm -rf debian/runit/package/admin/runit-0.3.3/doc
-	cp -a debian/runit/package/admin/runit-0.3.3/etc .
-	rm -rf debian/runit/package/admin/runit-0.3.3/etc
-	cp -a debian/runit/package/admin/runit-0.3.3/package .
+	rm -rf debian/runit/package/admin/runit-0.4.0/compile
+	cp -a debian/runit/package/admin/runit-0.4.0/man .
+	rm -rf debian/runit/package/admin/runit-0.4.0/man
+	cp -a debian/runit/package/admin/runit-0.4.0/doc .
+	rm -rf debian/runit/package/admin/runit-0.4.0/doc
+	cp -a debian/runit/package/admin/runit-0.4.0/etc .
+	rm -rf debian/runit/package/admin/runit-0.4.0/etc
+	cp -a debian/runit/package/admin/runit-0.4.0/package .
 
 	# /etc/runit
-	cp -p admin/runit-0.3.3/etc/debian/[123] \
+	cp -p admin/runit-0.4.0/etc/debian/[123] \
 		debian/runit/etc/runit/
-	cp -p admin/runit-0.3.3/etc/debian/ctrlaltdel \
+	cp -p admin/runit-0.4.0/etc/debian/ctrlaltdel \
 		debian/runit/etc/runit/
-	cp -p admin/runit-0.3.3/etc/debian/getty-tty5/run \
-		debian/runit/etc/runit/getty-5/
+	cp -p admin/runit-0.4.0/etc/debian/getty-tty5/run.utmpset \
+		debian/runit/etc/runit/getty-5/run
 
 	# runit programs
-	cp -p debian/runit/package/admin/runit-0.3.3/command/runit* \
+	cp -p debian/runit/package/admin/runit-0.4.0/command/runit* \
 		debian/runit/sbin/
 
 	# cleanup
-	rm -rf debian/runit/package/admin/runit-0.3.3/compile
+	rm -rf debian/runit/package/admin/runit-0.4.0/compile
 
 	# create debian/links
 	rm -f debian/links
 	for i in \
-	 `cat debian/runit/package/admin/runit-0.3.3/package/commands` ; \
+	 `cat debian/runit/package/admin/runit-0.4.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.3.3/package/commands` ; \
+#	 `cat debian/runit/package/admin/runit-0.4.0/package/commands` ; \
 #	do \
 #	  echo "/command/$$i /usr/local/bin/$$i" \
 #		>> debian/links ; \
diff --git a/doc/index.html b/doc/index.html
index 712eefe..400c696 100644
--- a/doc/index.html
+++ b/doc/index.html
@@ -20,6 +20,8 @@ Dependencies and runlevels</a>
 <a href="runit-init.8.html">The <tt>runit-init</tt> program</a><br>
 <a href="svwaitdown.8.html">The <tt>svwaitdown</tt> program</a><br>
 <a href="svwaitup.8.html">The <tt>svwaitup</tt> program</a>
+<p>
+<a href="utmpset.html">The <tt>utmpset</tt> program</a>
 <hr>
 <i>runit</i> cooperates with the
 <a href="http://cr.yp.to/daemontools.html">daemontools</a> package to create
@@ -86,13 +88,13 @@ This is from the second machine where I replaced <i>sysvinit</i> with
   # strings /proc/1/exe |grep Id
   &#36;Id: runit.c,v 1.5 2001/12/30 16:28:53 pape Exp &#36;
   # uptime
-  10:35:18 up 107 days, 15:46,  2 users,  load average: 0.00, 0.00, 0.00
+   19:44:10 up 139 days,  1:09,  3 users,  load average: 0.00, 0.00, 0.00
   # ps axuw |head
   USER       PID %CPU %MEM   VSZ  RSS TTY      STAT START   TIME COMMAND
   root         1  0.0  0.0    24   24 ?        S     2001   0:06 runit
-  root         2  0.0  0.0     0    0 ?        SW    2001   0:07 [kflushd]
-  root         3  0.0  0.0     0    0 ?        SW    2001   0:06 [kupdate]
-  root         4  0.0  0.0     0    0 ?        SW    2001   0:28 [kswapd]
+  root         2  0.0  0.0     0    0 ?        SW    2001   0:09 [kflushd]
+  root         3  0.0  0.0     0    0 ?        SW    2001   0:07 [kupdate]
+  root         4  0.0  0.0     0    0 ?        SW    2001   0:35 [kswapd]
   root         5  0.0  0.0     0    0 ?        SW    2001   0:00 [keventd]
   root       149  0.0  0.1  1692  120 ?        S     2001   0:00 /usr/sbin/cron
   root       152  0.0  0.0  2196    0 ?        SW    2001   0:00 [svscanboot]
@@ -132,18 +134,18 @@ This is from a more busy system:
   # strings /proc/1/exe |grep Id
   &#36;Id: runit.c,v 1.6 2002/01/29 18:56:36 pape Exp &#36;
   # uptime
-  10:44:34 up 68 days, 10:48,  3 users,  load average: 0.24, 0.45, 0.34
+   19:46:24 up 99 days, 19:56,  3 users,  load average: 0.15, 0.12, 0.12
   # ps axuw |head
   USER       PID %CPU %MEM   VSZ  RSS TTY      STAT START   TIME COMMAND
-  root         1  0.0  0.0    24   24 ?        S    Feb07   0:05 runit
+  root         1  0.0  0.0    24    0 ?        SW   Feb07   0:05 runit
   root         2  0.0  0.0     0    0 ?        SW   Feb07   0:01 [keventd]
-  root         3  0.0  0.0     0    0 ?        SW   Feb07   1:00 [kapm-idled]
-  root         4  0.0  0.0     0    0 ?        SWN  Feb07   0:44 [ksoftirqd_CPU0]
-  root         5  0.0  0.0     0    0 ?        SW   Feb07   7:02 [kswapd]
+  root         3  0.0  0.0     0    0 ?        SW   Feb07   1:10 [kapm-idled]
+  root         4  0.0  0.0     0    0 ?        SWN  Feb07   1:09 [ksoftirqd_CPU0]
+  root         5  0.0  0.0     0    0 ?        SW   Feb07  13:23 [kswapd]
   root         6  0.0  0.0     0    0 ?        SW   Feb07   0:00 [bdflush]
-  root         7  0.0  0.0     0    0 ?        SW   Feb07   8:06 [kupdated]
+  root         7  0.0  0.0     0    0 ?        SW   Feb07  10:18 [kupdated]
   root        53  0.0  0.0     0    0 ?        SW   Feb07   0:00 [msp3410 [auto]]
-  daemon     115  0.0  0.0  1412   20 ?        S    Feb07   0:00 /sbin/portmap
+  daemon     115  0.0  0.0  1412    8 ?        S    Feb07   0:00 /sbin/portmap
 </pre>
 <hr>
 See <a href="install.html">How to install runit</a> for installing
diff --git a/doc/install.html b/doc/install.html
index 047767f..aae8d4a 100644
--- 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.3.3.tar.gz">runit-0.3.3.tar.gz</a> into <tt>/package</tt>
+<a href="runit-0.4.0.tar.gz">runit-0.4.0.tar.gz</a> into <tt>/package</tt>
 and unpack the archive
 <pre>
   # cd /package
-  # gunzip runit-0.3.3.tar
-  # tar -xpf runit-0.3.3.tar
-  # rm runit-0.3.3.tar
-  # cd admin/runit-0.3.3
+  # gunzip runit-0.4.0.tar
+  # tar -xpf runit-0.4.0.tar
+  # rm runit-0.4.0.tar
+  # cd admin/runit-0.4.0
 </pre>
 Compile and install the <i>runit</i> programs
 <pre>
diff --git a/doc/replaceinit.html b/doc/replaceinit.html
index 93fd8eb..f3c1953 100644
--- 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.3.3@smarden.org
+  # ( uname -a ; cat /etc/runit/[123] ) | mail pape-runit-0.4.0@smarden.org
 </pre>
 <hr>
 
@@ -187,7 +187,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.3.3@smarden.org
+  # ( uname -a ; cat /etc/runit/[123] ) | mail pape-runit-0.4.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/utmpset.html b/doc/utmpset.html
new file mode 100644
index 0000000..86f978e
--- /dev/null
+++ b/doc/utmpset.html
@@ -0,0 +1,52 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<title>runit - the utmpset program</title>
+</head>
+<body>
+<a href="http://smarden.org/pape/">G. Pape</a><br>
+<a href="index.html">runit</a><br>
+<hr>
+<h1>runit - the utmpset program</h1>
+<hr>
+Ordinary <i>init</i> processes handle <tt>utmp</tt> file records for
+local login accounting. The <a href="runit.8.html">runit</a> program doesn't
+include code to update the <tt>utmp</tt> file, the <tt>getty</tt> processes
+are handled the same as all other services. So normally on systems running
+with <i>runit</i> local login accounting doesn't work as expected: The
+<tt>utmp</tt> file is not updated after a user logs out.
+<p>
+This can be done by the <i>utmpset</i> program.
+<p>
+To compile the <i>utmpset</i> program change to the <i>runit</i> package's
+source directory:
+<pre>
+  # cd /package/admin/runit/src
+</pre>
+The <i>utmpset</i> program cannot be used with the
+<a href="http://www.fefe.de/dietlibc/">diet libc</a> since it needs to be
+linked against <tt>libutil</tt>. Change <tt>conf-cc</tt> and <tt>conf-ld</tt>
+if necessary.
+<p>
+Then build and install the <i>utmpset</i> program:
+<pre>
+  # make utmpset
+  # install -m0755 utmpset ../command/utmpset
+</pre>
+For each <tt>getty</tt> service, add a line to the corresponding <tt>run</tt>
+script like this:
+<pre>
+  #!/bin/sh
+  /package/admin/runit/command/utmpset tty5
+  exec /sbin/getty 38400 tty5 linux
+</pre>
+This will cause the <tt>utmp</tt> record for line <tt>tty5</tt> to be cleared
+before the <tt>getty</tt> is started; login accounting works as expected for
+this line.
+<hr>
+<address><a href="mailto:pape@smarden.org">
+Gerrit Pape &lt;pape@smarden.org&gt;
+</a></address>
+<small>$Id$</small>
+</body>
+</html>
diff --git a/etc/debian/getty-tty5/run.utmpset b/etc/debian/getty-tty5/run.utmpset
new file mode 100755
index 0000000..a724451
--- /dev/null
+++ b/etc/debian/getty-tty5/run.utmpset
@@ -0,0 +1,3 @@
+#!/bin/sh
+/package/admin/runit/command/utmpset tty5
+exec /sbin/getty 38400 tty5 linux
diff --git a/package/CHANGES b/package/CHANGES
index d6b701a..21ea566 100644
--- a/package/CHANGES
+++ b/package/CHANGES
@@ -1,7 +1,9 @@
-runit 0.3.3
-Sat, 18 May 2002 19:20:46 +0200
+runit 0.4.0
+Sun, 19 May 2002 12:28:29 +0200
   * src/: include public domain sources to build byte.a, unix.a, time.a:
     runit builds without having daemontools' sources installed.
+  * utmpset.c: new utmpset program.
+  * doc/utmpset.html: new.
 
 runit 0.3.2
 Wed, 13 Feb 2002 10:56:17 +0100
diff --git a/package/upgrade b/package/upgrade
index 4347d49..eb35d13 100755
--- 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.3.3...'
+echo 'Creating symlink runit -> runit-0.4.0...'
 rm -f runit
-ln -s runit-0.3.3 runit
+ln -s runit-0.4.0 runit
 mv -f runit ..
 
 echo 'Making command links in /command...'
diff --git a/src/Makefile b/src/Makefile
index 8b1eba2..aed7245 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -26,6 +26,12 @@ svwaitup.o: compile svwaitup.c uint64.h
 svwaitdown.o: compile svwaitdown.c uint64.h
 	./compile svwaitdown.c
 
+utmpset: load utmpset.o unix.a byte.a
+	./load utmpset unix.a byte.a -lutil
+
+utmpset.o: compile utmpset.c
+	./compile utmpset.c
+
 clean:
 	find . -name \*~ -exec rm -f {} \;
 	find . -name .??*~ -exec rm -f {} \;
diff --git a/src/utmpset.c b/src/utmpset.c
new file mode 100644
index 0000000..b8223ef
--- /dev/null
+++ b/src/utmpset.c
@@ -0,0 +1,18 @@
+#include "strerr.h"
+
+#define USAGE " line"
+#define WARNING "utmpset: warning: "
+
+const char *progname;
+
+void usage(void) {
+  strerr_die4x(1, "usage: ", progname, USAGE, "\n");
+}
+
+int main (int argc, const char * const *argv, const char * const *envp) {
+  progname =*argv++;
+  if (! *argv || ! **argv) usage();
+  if (logout(*argv) != 1)
+    strerr_warn4(WARNING, "unable to logout line ", *argv, ": ", &strerr_sys);
+  exit(0);
+}