From: Chris Wedgwood <chris@cyphercom.com>
To: miquels@cistron.nl
Message-Id: <199704211756.NAA00728@x.cyphercom.com>
Date: Mon, 21 Apr 1997 13:56:08 -0400
Subject: sysvinit 2.69 - powerdown patches

Hi,

Here are some quick (and somewhat dirty) patches to sysvinit-2.69 to add
power down support. I was hoping to avoid adding an additional run-level,
but to maintain compatibility with older init binaries, there doesn't seem
to be a clean way. 

I have used run level 7 to signal power down. This is really only required
for linux 2.1.x and 2.0.x will power down when halted if the kernel is
compiled in such a way. I wasn't all that happy about this, as System V
doesn't use this - but when I think about it, this init is very linux
specific, and it shouldn't break anything that presently exists...

I did not update the version numbers or lsm if you decide to use these
patches, and the readme is somewhat sketchy.


-Chris





diff -Nur sysvinit-2.69/HISTORY sysvinit-2.69-cw/HISTORY
--- sysvinit-2.69/HISTORY	Tue Nov 12 06:16:00 1996
+++ sysvinit-2.69-cw/HISTORY	Mon Apr 21 13:50:19 1997
@@ -226,3 +226,5 @@
 - Remove old symlink in /var/log/initlvl; let init check both
   /var/log and /etc itself.
 
+2.69+	22-April-1997	Chris Wedgwood, chris@cybernet.co.nz
+- Quickly kludged in power down support. Bryan! It's here, stop whining!
diff -Nur sysvinit-2.69/Install sysvinit-2.69-cw/Install
--- sysvinit-2.69/Install	Wed Sep  4 05:54:43 1996
+++ sysvinit-2.69-cw/Install	Mon Apr 21 13:46:16 1997
@@ -4,7 +4,7 @@
           !! READ THE FILE README.RIGHT.NOW FIRST !!
 
 
-init, shutdown, halt, reboot, wall, last, mesg, runlevel,
+init, shutdown, halt, reboot, powerdown, wall, last, mesg, runlevel,
 killall5, pidof, sulogin.
 
 All programs, files and scripts in this package are covered by
@@ -21,6 +21,7 @@
 inittab.5, initscript.5	   /usr/man/man5
 init.8, halt.8, reboot.8,
 shutdown.8, powerd.8,
+powerdown.8,
 killall5.8, pidof.8,
 runlevel.8, sulogin.8	   /usr/man/man8
 
@@ -56,4 +57,8 @@
   IF you use a Linux kernel > 1.3.66. Older kernels don't allow
   writing to a FIFO on a read-only file system.
   
+The power down stuff is really only for linux 2.1.x and later. (2.0.x works,
+but this release isn't required as it's the behavior for halt when compiled
+into the kernel). [CW]
+
 Miquel van Smoorenburg, miquels@drinkel.cistron.nl, miquels@cistron.nl
diff -Nur sysvinit-2.69/Makefile sysvinit-2.69-cw/Makefile
--- sysvinit-2.69/Makefile	Tue Oct 29 07:32:00 1996
+++ sysvinit-2.69-cw/Makefile	Mon Apr 21 11:41:47 1997
@@ -82,6 +82,7 @@
 		$(INSTALL) -m 755 mesg last $(ROOT)/usr/bin
 		cd $(ROOT)/usr/bin; ln -sf last lastb; chown $(BIN_COMBO) lastb
 		cd $(ROOT)/sbin; ln -sf halt reboot; chown $(BIN_COMBO) reboot
+		cd $(ROOT)/sbin; ln -sf halt powerdown; chown $(BIN_COMBO) powerdown
 		cd $(ROOT)/sbin; ln -sf killall5 pidof; chown $(BIN_COMBO) pidof
 		cd $(ROOT)/sbin; ln -sf init telinit; chown $(BIN_COMBO) telinit
 		$(INSTALL) -m 644 *.8 $(ROOT)/usr/man/man8
diff -Nur sysvinit-2.69/README.PowerDown sysvinit-2.69-cw/README.PowerDown
--- sysvinit-2.69/README.PowerDown	Wed Dec 31 19:00:00 1969
+++ sysvinit-2.69-cw/README.PowerDown	Mon Apr 21 13:48:14 1997
@@ -0,0 +1,38 @@
+Some architectures have the ability to power the system down after they have
+halted. As far as I know this really only (presently) applies to i386 system
+which are APM 1.1 compliant, and a few which aren't. (Many laptops aren't
+strictly APM 1.1 compliant, even though the claim to be - however, the power
+down facility usually does work).
+
+In 2.0.x (and probably 1.2.x?) this is achieved by by compiling the kernel
+with APM support (character devices, APM) and enabled the Power off on
+Shutdown option. When a pre 2.1.x kernel is halted, it will power down. So,
+for these kernels, using "shutdown -h <time>" will power down the machine.
+If you specify -p (instead of -h) the call to power down the system will
+fail, the program will halt for 5 seconds, then ask the kernel to halt in
+the traditional manner - so the machine will still be powered down.
+
+With 2.1.x things changed slightly. You still need to enable the options as
+above, but now a halt does exactly that - halts the system. To power down
+the kernel needs to be told to power down - not halt. To power down the
+newer kernels you must use the -p option.
+
+I have modified the slackware rc.6 script so when invoked as rc.7 is should
+work correctly. (As I don't use an particular distribution, I could be
+telling big lies though). You must make a symlink from rc.6 to rc.7. I have
+not edited the Debian files as they are evil and blow chunks (I myself
+don't like having 101 little files to edit). If someone else would like to
+do so then please do.
+
+Notes:
+
+  [1] The powerdown program and powerdown options of shutdown have
+      absolutely nothing to do with powerd - the UPS daemon.
+
+  [2] I have chosen runlevel 7 and the powerdown runlevel. Most (no?) other
+      unicies (unixes?) will support this... not that any of this init
+      package or scripts will be any good for any other unix anyhow.
+
+Chris Wedgwood, <chris@cybernet.co.nz>
+April 21, 1997. Just before lunch... mmm.. 'Big Bacon Classic' burger...
+
diff -Nur sysvinit-2.69/debian/etc/ispell.tmp.bak sysvinit-2.69-cw/debian/etc/ispell.tmp.bak
--- sysvinit-2.69/debian/etc/ispell.tmp.bak	Wed Dec 31 19:00:00 1969
+++ sysvinit-2.69-cw/debian/etc/ispell.tmp.bak	Mon Apr 21 11:46:57 1997
@@ -0,0 +1 @@
+Poswer
\ No newline at end of file
diff -Nur sysvinit-2.69/halt.8 sysvinit-2.69-cw/halt.8
--- sysvinit-2.69/halt.8	Fri Jun 14 09:34:44 1996
+++ sysvinit-2.69-cw/halt.8	Mon Apr 21 13:48:39 1997
@@ -1,10 +1,10 @@
 .\"{{{}}}
 .\"{{{  Title
-.TH HALT,REBOOT 8 "December 10, 1995" "" "Linux System Administrator's Manual"
+.TH HALT 8 "April 22, 1997" "" "Linux System Administrator's Manual"
 .\"}}}
 .\"{{{  Name
 .SH NAME
-halt, reboot \- stop the system.
+halt, reboot, powerdown \- stop the system.
 .\"}}}
 .\"{{{  Synopsis
 .SH SYNOPSIS
@@ -19,26 +19,31 @@
 .RB [ \-w ]
 .RB [ \-d ]
 .RB [ \-f ]
+.br
+.B /sbin/powerdown
+.RB [ \-n ]
+.RB [ \-w ]
+.RB [ \-d ]
+.RB [ \-f ]
 .\"}}}
 .\"{{{  Description
 .SH DESCRIPTION
 \fBHalt\fP notes that the system is being brought down in the file
 \fB/var/log/wtmp\fP, and then either tells the kernel to halt or
-reboot the system. If \fIhalt\fP or \fIreboot\fP is called when the system is
+reboot the system. If called when the system is
 \fInot\fP in runlevel \fB0\fP or \fB6\fP, \fIshutdown(8)\fP will be
 invoked instead (with the flag \fB-h\fP or \fB-r\fP).
 .\"}}}
 .\"{{{  Options
 .SH OPTIONS
 .IP \fB\-n\fP
-Don't sync before reboot or halt.
+Don't sync before reboot, halt or powerdown.
 .IP \fB\-w\fP
-Don't actually reboot or halt but only write the wtmp record
-(in the \fB/var/log/wtmp\fP file).
+Only write the wtmp record (in the \fB/var/log/wtmp\fP file).
 .IP \fB\-d\fP
 Don't write the wtmp record. The \fB\-n\fP flag implies \fB\-d\fP.
 .IP \fB\-f\fP
-Force halt or reboot, don't call shutdown.
+Force halt, reboot or powerdown, don't call shutdown.
 .\"}}}
 .\"{{{  Diagnostics
 .SH DIAGNOSTICS
@@ -46,14 +51,17 @@
 .\"}}}
 .\"{{{  Notes
 .SH NOTES
-Under previous \fBsysvinit\fP releases, \fIreboot\fP and \fIhalt\fP should
-never be called directly. From this release on \fIhalt\fP and \fIreboot\fP
-invoke \fIshutdown\fP if the system is in runlevel 1-5.
+Under previous \fBsysvinit\fP releases, \fIreboot\fP, \fIhalt\fP and
+\fIpowerdown\fP should never be called directly. From this release on 
+\fIhalt\fP, \fIreboot\fP and \fIpowerdown\fP invoke \fIshutdown\fP if the 
+system is in runlevel 1-5.
 .PP
 .\"}}}
 .\"{{{  Author
 .SH AUTHOR
 Miquel van Smoorenburg, miquels@cistron.nl
+.PP
+(powerdown stuff by Chris Wedgwood, chris@cybernet.co.nz)
 .\"}}}
 .\"{{{  See also
 .SH "SEE ALSO"
diff -Nur sysvinit-2.69/halt.c sysvinit-2.69-cw/halt.c
--- sysvinit-2.69/halt.c	Tue Aug 13 05:55:58 1996
+++ sysvinit-2.69-cw/halt.c	Mon Apr 21 13:48:47 1997
@@ -1,21 +1,22 @@
 /*
  * Halt		Stop the system running.
+ *
  *		It re-enables CTRL-ALT-DEL, so that a hard reboot can
  *		be done. If called as reboot, it will reboot the system.
  *
- *		If the system is not in runlevel 0 or 6, halt will just
- *		execute a "shutdown -h" to halt the system, and reboot will
- *		execute an "shutdown -r". This is for compatibility with
- *		sysvinit 2.4.
+ *		If the system is not in runlevel 0, 6 or 7, halt will just execute
+ *		a "shutdown -h" to halt the system, reboot will execute an
+ *		"shutdown -r" and powerdown will execute "shutdown -p". This is
+ *		for compatibility with sysvinit 2.4.
  *
  * Usage:	halt [-n] [-w] [-d] [-f]
  *		-n: don't sync before halting the system
  *		-w: only write a wtmp reboot record and exit.
  *		-d: don't write a wtmp record.
- *		-f: force halt/reboot, don't call shutdown.
+ *		-f: force halt/reboot/powerdown, don't call shutdown.
  *
- *		Reboot and halt are both this program. Reboot
- *		is just a link to halt.
+ *		reboot, halt and powerdown are all this program. reboot and
+ *		powerdown are just links to halt.
  *
  * Author:	Miquel van Smoorenburg, miquels@drinkel.cistron.nl
  *
@@ -28,6 +29,9 @@
  *		modify it under the terms of the GNU General Public License
  *		as published by the Free Software Foundation; either version
  *		2 of the License, or (at your option) any later version.
+ *
+ *	Powerdown modifications, Chris Wedgwood, <chris@cybernet.co.nz>
+ *							 April 22, 1997.
  */
 
 #include <sys/types.h>
@@ -142,6 +146,7 @@
   struct utmp wtmp;
   int fd;
   int do_reboot = 0;
+  int do_powerdown = 0;
   int do_sync = 1;
   int do_wtmp = 1;
   int do_nothing = 0;
@@ -164,6 +169,8 @@
 
   if (!strcmp(progname, "reboot")) do_reboot = 1;
 
+  if (!strcmp(progname, "powerdown")) do_powerdown = 1;
+
   /* Get flags */
   while((c = getopt(argc, argv, ":dfnwt:")) != EOF) {
 	switch(c) {
@@ -193,10 +200,10 @@
 
 #if COMPATIBLE
   if (!do_hard && !do_nothing) {
-	/* See if we are in runlevel 0 or 6. */
+	/* runlevels 2 to 5 (inclusive) */
 	c = get_runlevel();
 	if (c > '0' && c < '6')
-		do_shutdown(do_reboot ? "-r" : "-h", tm);
+		do_shutdown(do_powerdown?"-p":(do_reboot?"-r":"-h"),tm);
   }
 #endif
 
@@ -224,6 +231,12 @@
 	sleep(2);
   }
 
+  if(do_powerdown){
+	init_reboot(BMAGIC_PWROFF);
+	/* oops, failed... just halt */
+	do_reboot = 0; /* shouldn't really need this */
+  }
+  
   if (do_reboot) {
 	init_reboot(BMAGIC_REBOOT);
   } else {
diff -Nur sysvinit-2.69/init.8 sysvinit-2.69-cw/init.8
--- sysvinit-2.69/init.8	Tue Oct 29 07:45:06 1996
+++ sysvinit-2.69-cw/init.8	Mon Apr 21 13:49:27 1997
@@ -1,6 +1,6 @@
 .\"{{{}}}
 .\"{{{  Title
-.TH INIT 8 "Oct 29, 1996" "" "Linux System Administrator's Manual"
+.TH INIT 8 "April 22, 1997" "" "Linux System Administrator's Manual"
 .\"}}}
 .\"{{{  Name
 .SH NAME
@@ -10,11 +10,11 @@
 .SH SYNOPSIS
 .B /sbin/init
 .RB [ " \-t sec " ]
-.RB [ " 0123456SsQq " ]
+.RB [ " 01234567SsQq " ]
 .br
 .B /sbin/telinit
 .RB [ " \-t sec " ]
-.RB [ " 0123456sSQqabc " ]
+.RB [ " 01234567sSQqabc " ]
 .\"}}}
 .\"{{{  Description
 .SH DESCRIPTION
@@ -33,7 +33,7 @@
 only a selected group of processes to exist.  The processes spawned by
 \fBinit\fP for each of these \fIrun levels\fP are defined in the
 \fB/etc/inittab\fP file.  \fBInit\fP can be in one of eight \fIrun
-level\fPs, \fB0\(en6\fP and \fBS\fP or \fBs\fP.  The \fIrun level\fP is
+level\fPs, \fB0\(en7\fP and \fBS\fP or \fBs\fP.  The \fIrun level\fP is
 changed by having a privileged user run \fB/sbin/telinit\fP, which sends
 appropriate signals to \fBinit\fP, telling it which run level to change
 to.
@@ -50,6 +50,8 @@
 In case you wonder, runlevels \fIS\fP and \fIs\fP are in fact the same.
 Internally they are aliases for the same runlevel - this is just a leftover from
 the systems the author used to use when writing sysvinit.
+.PP
+\fBNote:\fP runlevel \fB7\fP is now used to signal power down.
 .\"}}}
 .PP
 .SH BOOTING
@@ -111,7 +113,7 @@
 one-character argument and signals \fBinit\fP to perform the appropriate
 action.  The following arguments serve as directives to
 \fB/sbin/telinit\fP:
-.IP "\fB0\fP,\fB1\fP,\fB2\fP,\fB3\fP,\fB4\fP,\fB5\fP or \fB6\fP"
+.IP "\fB0\fP,\fB1\fP,\fB2\fP,\fB3\fP,\fB4\fP,\fB5\fP,\fB6\fP or \fB7\fP"
 tell \fB/sbin/init\fP to switch to the specified run level.
 .IP \fBa\fP,\fBb\fP,\fBc\fP
 tell \fB/sbin/init\fP to process only those \fB/etc/inittab\fP file
@@ -179,6 +181,8 @@
 \fI/etc/init.d\fP and \fI/etc/rc{runlevel}.d\fP.
 If your systems uses this convention, there should be a \fIREADME\fP
 file in the directory /etc/init.d explaining how these scripts work.
+.PP
+\fBNote:\fP The powerdown runlevel (\fI7\fP) is linux specific.
 .\"}}}
 .\"{{{  Warnings
 .SH WARNINGS
@@ -202,9 +206,10 @@
 .SH AUTHOR
 Miquel van Smoorenburg (miquels@cistron.nl), initial manual
 page by Michael Haardt (u31b3hs@pool.informatik.rwth-aachen.de).
+powerdown by Chris Wedgwood, chris@cybernet.co.nz.
 .\"}}}
 .\"{{{  See also
 .SH "SEE ALSO"
 getty(1), login(1), sh(1), who(1), shutdown(1), kill(2), inittab(5),
-initscript(5), utmp(5)
+initscript(5), powerdown(8), utmp(5)
 .\"}}}
diff -Nur sysvinit-2.69/ispell.tmp.bak sysvinit-2.69-cw/ispell.tmp.bak
--- sysvinit-2.69/ispell.tmp.bak	Wed Dec 31 19:00:00 1969
+++ sysvinit-2.69-cw/ispell.tmp.bak	Mon Apr 21 13:50:14 1997
@@ -0,0 +1 @@
+- Quickly kludged in powerdown support. Bryan! It's here, stop whining!
diff -Nur sysvinit-2.69/powerdown.8 sysvinit-2.69-cw/powerdown.8
--- sysvinit-2.69/powerdown.8	Wed Dec 31 19:00:00 1969
+++ sysvinit-2.69-cw/powerdown.8	Mon Apr 21 12:16:31 1997
@@ -0,0 +1 @@
+.so man8/halt.8
diff -Nur sysvinit-2.69/reboot.h sysvinit-2.69-cw/reboot.h
--- sysvinit-2.69/reboot.h	Tue Jul 23 14:26:45 1996
+++ sysvinit-2.69-cw/reboot.h	Mon Apr 21 13:49:35 1997
@@ -4,6 +4,7 @@
  *
  * Version:	@(#)reboot.h  1.00  23-Jul-1996  miquels@cistron.nl
  *
+ * powerdown evils, Chris Wedgwood, chris@cybernet.co.nz.
  */
 
 #if __GNU_LIBRARY__ >= 6
@@ -14,6 +15,7 @@
 #define BMAGIC_SOFT	0
 #define BMAGIC_REBOOT	0x01234567
 #define BMAGIC_HALT	0xCDEF0123
+#define BMAGIC_PWROFF  0x4321FEDC
 
 #if __GNU_LIBRARY__ >= 6
   #define init_reboot(magic) reboot(magic)
diff -Nur sysvinit-2.69/shutdown.8 sysvinit-2.69-cw/shutdown.8
--- sysvinit-2.69/shutdown.8	Fri Jun 14 09:36:02 1996
+++ sysvinit-2.69-cw/shutdown.8	Mon Apr 21 13:49:19 1997
@@ -27,7 +27,9 @@
 to exit cleanly, etc. \fBShutdown\fP does it's job by signalling the
 \fBinit\fP process, asking it to change the \fIrunlevel\fP.
 \fIRunlevel 0\fP is used to halt the system, \fIrunlevel 6\fP is used
-to reboot the system and \fIrunlevel 1\fP is used to put to system into
+to reboot the system, 
+\fIrunlevel 7\fP is used to power down the system, and
+\fIrunlevel 1\fP is used to put to system into
 a state where administrative tasks can be performed; this is the default
 if neither the \fI-h\fP or \fI-r\fP flag is given to \fBshutdown\fP.
 To see which actions are taken on halt or reboot see the appropriate
@@ -48,6 +50,10 @@
 .IP \fB\-r\fP
 Reboot after shutdown.
 .\"}}}
+.\"{{{  -p
+.IP \fB\-p\fP
+Power down after shutdown.
+.\"}}}
 .\"{{{  -h
 .IP \fB\-h\fP
 Halt after shutdown.
@@ -137,6 +143,8 @@
 .\"{{{  Author
 .SH AUTHOR
 Miquel van Smoorenburg, miquels@cistron.nl
+.PP
+(powerdown by Chris Wedgwood, chris@cybernet.co.nz)
 .\"}}}
 .\"{{{  See also
 .SH "SEE ALSO"
diff -Nur sysvinit-2.69/shutdown.c sysvinit-2.69-cw/shutdown.c
--- sysvinit-2.69/shutdown.c	Tue Aug 13 05:56:19 1996
+++ sysvinit-2.69-cw/shutdown.c	Mon Apr 21 12:13:38 1997
@@ -4,6 +4,7 @@
  * Usage:	shutdown [-krhfnc] time [warning message]
  *		  -k: don't really shutdown, only warn.
  *		  -r: reboot after shutdown.
+ *		  -p: power down the machine after shutdown.
  *		  -h: halt after shutdown.
  *		  -f: do a 'fast' reboot.
  *		  -n: do not go through init but do it ourselves.
@@ -44,6 +45,7 @@
 char down_level[2];	/* What runlevel to go to.	*/
 int dosync = 1;		/* Sync before reboot or halt	*/
 int fastboot = 0;	/* Do a 'fast' reboot		*/
+int powerdown = 0;	/* power off the machine */
 char message[MESSAGELEN];	/* Warning message	*/
 char *sltime = 0;	/* Sleep time			*/
 char newstate[64];	/* What are we gonna do		*/
@@ -73,6 +75,7 @@
 	"Usage:\t  shutdown [-krhfnc] [-t secs] time [warning message]\n"
 	"\t\t  -k:      don't really shutdown, only warn.\n"
 	"\t\t  -r:      reboot after shutdown.\n"
+	"\t\t  -p:      power down after shutdown.\n"
 	"\t\t  -h:      halt after shutdown.\n"
 	"\t\t  -f:      do a 'fast' reboot.\n"
 	"\t\t  -n:      do not go through \"init\" but go down real fast.\n"
@@ -203,7 +206,15 @@
   fprintf(stderr, "shutdown: unmounting all file systems\r\n");
   system("umount -a");
 
-  /* We're done, halt or reboot now. */
+  /* We're done, halt, power down or reboot now. */
+  if(powerdown){
+  	fprintf(stderr,"The system is being powered down. Bye!\r\n");
+	init_reboot(BMAGIC_PWROFF);
+	sleep(5); /* Wait to see if power down fails! */  	
+	fprintf(stderr,"Power down failed - halting\r\n");
+	do_halt = 1;
+  }
+	
   if (do_halt) {
 	fprintf(stderr, "The system is halted. Press CTRL-ALT-DEL or turn off power\r\n");
 	init_reboot(BMAGIC_HALT);
@@ -335,7 +346,7 @@
   }
 
   /* Process the options. */
-  while((c = getopt(argc, argv, "cqkrhnfyt:g:i:")) != EOF) {
+  while((c = getopt(argc, argv, "cqkrphnfyt:g:i:")) != EOF) {
   	switch(c) {
 		case 'c': /* Cancel an already running shutdown. */
 			cancel = 1;
@@ -345,6 +356,10 @@
   			break;
   		case 'r': /* Automatic reboot */
 			down_level[0] = '6';
+  			break;
+  		case 'p': /* power down */
+			down_level[0] = '7';
+			powerdown = 1;
   			break;
   		case 'h': /* Halt after shutdown */
 			down_level[0] = '0';
diff -Nur sysvinit-2.69/slackware/etc/rc.d/rc.0 sysvinit-2.69-cw/slackware/etc/rc.d/rc.0
--- sysvinit-2.69/slackware/etc/rc.d/rc.0	Tue Aug 13 06:24:52 1996
+++ sysvinit-2.69-cw/slackware/etc/rc.d/rc.0	Mon Apr 21 13:33:55 1997
@@ -1,14 +1,15 @@
-#! /bin/sh
+#!/bin/sh
 #
-# rc.6		This file is executed by init when it goes into runlevel
-#		0 (halt) or runlevel 6 (reboot). It kills all processes,
-#		unmounts file systems and then either halts or reboots.
+# rc.x		This file is executed by init when it goes into runlevel
+#		0 (halt), runlevel 6 (reboot) or runlevel 7 (powerdown). It
+#		kills all processes, unmounts file systems and then either
+#		halts or reboots.
 #
-# Version:	@(#)/etc/rc.d/rc.6	1.50	1994-01-15
+# Version:	@(#)/etc/rc.d/rc.{0,6,7}	1.51	1997-04-22
 #
 # Author:	Miquel van Smoorenburg <miquels@cistron.nl>
 # Modified by:  Patrick J. Volkerding, <volkerdi@ftp.cdrom.com>
-#
+# Modified by:	Chris Wedgwood, <chris@blort.com>
 
   # Set the path.
   PATH=/sbin:/etc:/bin:/usr/bin
@@ -28,8 +29,12 @@
 		message="Rebooting."
 		command=reboot
 		;;
+	*7)
+		message="The system is powering down."
+		command=powerdown
+		;;
 	*)
-		echo "$0: call me as \"rc.0\" or \"rc.6\" please!"
+		echo "$0: call me as \"rc.0\", \"rc.6\" or \"rc.7\" please!"
 		exit 1
 		;;
   esac
@@ -77,6 +82,7 @@
   swapoff -a
   echo "Unmounting local file systems."
   umount -a -tnonfs
+
   # Don't remount UMSDOS root volumes:
   if [ ! "`mount | head -1 | cut -d ' ' -f 5`" = "umsdos" ]; then
     mount -n -o remount,ro /
diff -Nur sysvinit-2.69/slackware/etc/rc.d/rc.6 sysvinit-2.69-cw/slackware/etc/rc.d/rc.6
--- sysvinit-2.69/slackware/etc/rc.d/rc.6	Tue Aug 13 06:24:52 1996
+++ sysvinit-2.69-cw/slackware/etc/rc.d/rc.6	Mon Apr 21 13:33:55 1997
@@ -1,14 +1,15 @@
-#! /bin/sh
+#!/bin/sh
 #
-# rc.6		This file is executed by init when it goes into runlevel
-#		0 (halt) or runlevel 6 (reboot). It kills all processes,
-#		unmounts file systems and then either halts or reboots.
+# rc.x		This file is executed by init when it goes into runlevel
+#		0 (halt), runlevel 6 (reboot) or runlevel 7 (powerdown). It
+#		kills all processes, unmounts file systems and then either
+#		halts or reboots.
 #
-# Version:	@(#)/etc/rc.d/rc.6	1.50	1994-01-15
+# Version:	@(#)/etc/rc.d/rc.{0,6,7}	1.51	1997-04-22
 #
 # Author:	Miquel van Smoorenburg <miquels@cistron.nl>
 # Modified by:  Patrick J. Volkerding, <volkerdi@ftp.cdrom.com>
-#
+# Modified by:	Chris Wedgwood, <chris@blort.com>
 
   # Set the path.
   PATH=/sbin:/etc:/bin:/usr/bin
@@ -28,8 +29,12 @@
 		message="Rebooting."
 		command=reboot
 		;;
+	*7)
+		message="The system is powering down."
+		command=powerdown
+		;;
 	*)
-		echo "$0: call me as \"rc.0\" or \"rc.6\" please!"
+		echo "$0: call me as \"rc.0\", \"rc.6\" or \"rc.7\" please!"
 		exit 1
 		;;
   esac
@@ -77,6 +82,7 @@
   swapoff -a
   echo "Unmounting local file systems."
   umount -a -tnonfs
+
   # Don't remount UMSDOS root volumes:
   if [ ! "`mount | head -1 | cut -d ' ' -f 5`" = "umsdos" ]; then
     mount -n -o remount,ro /

