Browse Source

Prepare to use new upstream release version 2.88dsf-1.

upstream-debian/master
Petter Reinholdtsen 13 years ago
parent
commit
2fecb595a8
  1. 339
      COPYING
  2. 12
      COPYRIGHT
  3. 2
      Makefile
  4. 4
      README
  5. 220
      contrib/notify-pam-dead.patch
  6. 3
      debian/changelog
  7. 94
      doc/Changelog
  8. 17
      man/bootlogd.8
  9. 17
      man/bootlogd.8.todo
  10. 45
      man/fstab-decode.8
  11. 17
      man/halt.8
  12. 17
      man/init.8
  13. 17
      man/initscript.5
  14. 17
      man/inittab.5
  15. 21
      man/killall5.8
  16. 23
      man/last.1
  17. 17
      man/mesg.1
  18. 17
      man/mountpoint.1
  19. 43
      man/pidof.8
  20. 17
      man/runlevel.8
  21. 60
      man/shutdown.8
  22. 17
      man/sulogin.8
  23. 66
      man/utmpdump.1
  24. 17
      man/wall.1
  25. 17
      obsolete/powerd.8
  26. 19
      obsolete/powerd.c
  27. 19
      obsolete/utmpdump.c.OLD
  28. 91
      src/Makefile
  29. 106
      src/bootlogd.c
  30. 54
      src/dowall.c
  31. 86
      src/fstab-decode.c
  32. 22
      src/halt.c
  33. 136
      src/hddown.c
  34. 40
      src/ifdown.c
  35. 351
      src/init.c
  36. 25
      src/init.h
  37. 19
      src/initreq.h
  38. 540
      src/killall5.c
  39. 72
      src/last.c
  40. 19
      src/mesg.c
  41. 19
      src/mountpoint.c
  42. 16
      src/oldutmp.h
  43. 22
      src/paths.h
  44. 15
      src/reboot.h
  45. 19
      src/runlevel.c
  46. 18
      src/set.h
  47. 100
      src/shutdown.c
  48. 244
      src/sulogin.c
  49. 62
      src/utmp.c
  50. 23
      src/utmpdump.c
  51. 24
      src/wall.c

339
COPYING

@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or 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.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

12
COPYRIGHT

@ -15,5 +15,15 @@ Sysvinit is Copyright (C) 1991-2004 Miquel van Smoorenburg
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
On Debian GNU/Linux systems, the complete text of the GNU General
Public License can be found in `/usr/share/common-licenses/GPL'.
Public License can be found in `/usr/share/common-licenses/GPL-2'.
Send patches to sysvinit-devel@nongnu.org
The of the start-stop-daemon
* A rewrite of the original Debian's start-stop-daemon Perl script
* in C (faster - it is executed many times during system startup).
*
* Written by Marek Michalkiewicz <marekm@i17linuxb.ists.pwr.wroc.pl>,
* public domain.

2
Makefile

@ -0,0 +1,2 @@
all install clean distclean:
$(MAKE) -C src $@

4
README

@ -5,4 +5,6 @@ man Manual pages, not obsolete
obsolete Really obsolete stuff ;)
src Source code
Send patches to initscripts-ng-devel@lists.alioth.debian.org.
The project home is on http://savannah.nongnu.org/projects/sysvinit .
Send patches to sysvinit-devel@nongnu.org .

220
contrib/notify-pam-dead.patch

@ -0,0 +1,220 @@
Index: src/init.sample
===================================================================
--- src/init.sample (revision 0)
+++ src/init.sample (revision 0)
@@ -0,0 +1,9 @@
+#%PAM-1.0
+#
+# The PAM configuration file for /sbin/init
+# Used for updating the lastlog logging file
+#
+auth sufficient pam_rootok.so
+account include common-account
+session include common-session
+session requisite pam_lastlog.so silent
Index: src/init.c
===================================================================
--- src/init.c (revision 56)
+++ src/init.c (working copy)
@@ -76,6 +76,10 @@
#include "reboot.h"
#include "set.h"
+#ifdef USE_PAM
+extern void notify_pam_dead_session(const char *id);
+#endif
+
#ifndef SIGPWR
# define SIGPWR SIGUSR2
#endif
@@ -1129,6 +1133,9 @@
}
dup(f);
dup(f);
+#ifdef USE_PAM
+ notify_pam_dead_session(ch->id);
+#endif
}
/*
@@ -1548,6 +1555,9 @@
INITDBG(L_VB, "Updating utmp for pid %d [id %s]",
ch->pid, ch->id);
ch->flags &= ~RUNNING;
+#ifdef USE_PAM
+ notify_pam_dead_session(ch->id);
+#endif
if (ch->process[0] != '+')
write_utmp_wtmp("", ch->id, ch->pid, DEAD_PROCESS, NULL);
}
@@ -2009,6 +2019,9 @@
if (ch->flags & ZOMBIE) {
INITDBG(L_VB, "Child died, PID= %d", ch->pid);
ch->flags &= ~(RUNNING|ZOMBIE|WAITING);
+#ifdef USE_PAM
+ notify_pam_dead_session(ch->id);
+#endif
if (ch->process[0] != '+')
write_utmp_wtmp("", ch->id, ch->pid, DEAD_PROCESS, NULL);
}
@@ -2453,6 +2466,9 @@
if (ch->flags & ZOMBIE) {
INITDBG(L_VB, "Child died, PID= %d", ch->pid);
ch->flags &= ~(RUNNING|ZOMBIE|WAITING);
+#ifdef USE_PAM
+ notify_pam_dead_session(ch->id);
+#endif
if (ch->process[0] != '+')
write_utmp_wtmp("", ch->id, ch->pid, DEAD_PROCESS, NULL);
}
Index: src/utmp.c
===================================================================
--- src/utmp.c (revision 51)
+++ src/utmp.c (working copy)
@@ -34,10 +34,18 @@
#include <string.h>
#include <utmp.h>
+#if defined(USE_PAM) && defined(INIT_MAIN)
+# include <security/pam_appl.h>
+# include <security/pam_misc.h>
+#endif
+
#include "init.h"
#include "initreq.h"
#include "paths.h"
+#ifndef _PATH_DEV
+# define _PATH_DEV "/dev/"
+#endif
#if defined(__GLIBC__)
# if (__GLIBC__ == 2) && (__GLIBC_MINOR__ == 0) && defined(__powerpc__)
@@ -127,9 +135,9 @@
strncpy(utmp.ut_name, user, sizeof(utmp.ut_name));
strncpy(utmp.ut_id , id , sizeof(utmp.ut_id ));
strncpy(utmp.ut_line, line, sizeof(utmp.ut_line));
-
- /* Put the OS version in place of the hostname */
- if (uname(&uname_buf) == 0)
+
+ /* Put the OS version in place of the hostname */
+ if (uname(&uname_buf) == 0)
strncpy(utmp.ut_host, uname_buf.release, sizeof(utmp.ut_host));
#if HAVE_UPDWTMP
@@ -262,3 +270,75 @@
write_wtmp(user, id, pid, type, line && line[0] ? line : oldline);
}
+#if defined(USE_PAM) && defined(INIT_MAIN)
+static pam_handle_t *pamh = NULL;
+# ifdef __GNUC__
+static int
+null_conv(int num_msg, const struct pam_message **msgm,
+ struct pam_response **response __attribute__((unused)),
+ void *appdata_ptr __attribute__((unused)))
+# else
+static int
+null_conv(int num_msg, const struct pam_message **msgm,
+ struct pam_response **response, void *appdata_ptr)
+# endif
+{
+ int i;
+ for (i = 0; i < num_msg; i++) {
+ const struct pam_message *msg = msgm[i];
+ if (msg == (const struct pam_message*)0)
+ continue;
+ if (msg->msg == (char*)0)
+ continue;
+ switch (msg->msg_style) {
+ case PAM_ERROR_MSG:
+ case PAM_TEXT_INFO:
+ initlog(L_VB, "pam_message %s", msg->msg);
+ default:
+ break;
+ }
+ }
+ return 0;
+}
+static const struct pam_conv conv = { null_conv, NULL };
+# define PAM_FAIL_CHECK(func, args...) \
+ { \
+ if ((pam_ret = (func)(args)) != PAM_SUCCESS) { \
+ initlog(L_VB, "%s", pam_strerror(pamh, pam_ret)); \
+ goto pam_error; \
+ } \
+ }
+
+void notify_pam_dead_session(const char *id)
+{
+ struct utmp *oldut, ut;
+
+ setutent();
+
+ memset(&ut, 0, sizeof(ut));
+ ut.ut_type = DEAD_PROCESS;
+ strncpy(ut.ut_id, id, sizeof(ut.ut_id));
+
+ if ((oldut = getutid(&ut)) && (oldut->ut_type == USER_PROCESS)) {
+ int pam_ret;
+ char tty[UT_LINESIZE+ strlen(_PATH_DEV) + 1];
+
+ if (strncmp(oldut->ut_line, _PATH_DEV, strlen(_PATH_DEV)))
+ snprintf(tty, sizeof(tty), _PATH_DEV "%.*s",
+ UT_LINESIZE, oldut->ut_line);
+ else
+ snprintf(tty, sizeof(tty), "%.*s",
+ UT_LINESIZE, oldut->ut_line);
+
+ PAM_FAIL_CHECK(pam_start, "init", oldut->ut_user, &conv, &pamh);
+ PAM_FAIL_CHECK(pam_set_item, pamh, PAM_TTY, tty);
+ PAM_FAIL_CHECK(pam_set_item, pamh, PAM_RHOST, oldut->ut_host);
+ PAM_FAIL_CHECK(pam_close_session, pamh, PAM_SILENT);
+ pam_error:
+ pam_end(pamh, pam_ret);
+ }
+
+ endutent();
+}
+#endif /* USE_PAM && INIT_MAIN */
+
Index: src/Makefile
===================================================================
--- src/Makefile (revision 58)
+++ src/Makefile (working copy)
@@ -8,7 +8,7 @@
# Version: @(#)Makefile 2.85-13 23-Mar-2004 miquels@cistron.nl
#
-CPPFLAGS =
+CPPFLAGS = -DUSE_PAM
CFLAGS ?= -ansi -O2 -fomit-frame-pointer
override CFLAGS += -W -Wall -D_GNU_SOURCE
STATIC =
@@ -79,6 +79,13 @@
endif
# Additional libs for GNU libc.
+ifneq ($(findstring -DUSE_PAM,$(CPPFLAGS)),)
+ INITLIBS += -lpam
+ PAMDOTD = /etc/pam.d
+ PAMINIT = $(PAMDOTD)/init
+endif
+
+# Additional libs for GNU libc.
ifneq ($(wildcard /usr/lib*/libcrypt.a),)
SULOGINLIBS += -lcrypt
endif
@@ -153,6 +160,11 @@
$(STRIP) $$i ; \
$(INSTALL_EXEC) $$i $(ROOT)/usr/bin/ ; \
done
+ifneq ($(findstring -DUSE_PAM,$(CPPFLAGS)),)
+ $(INSTALL_DIR) $(ROOT)$(PAMDOTD)
+ test -s $(ROOT)$(PAMINIT) || \
+ $(INSTALL_DATA) init.sample $(ROOT)$(PAMINIT)
+endif
# $(INSTALL_DIR) $(ROOT)/etc/
# $(INSTALL_EXEC) initscript.sample $(ROOT)/etc/
ln -sf halt $(ROOT)/sbin/reboot

3
debian/changelog

@ -1,5 +1,6 @@
sysvinit (2.87dsf-11) UNRELEASED; urgency=low
sysvinit (2.88dsf-1) UNRELEASED; urgency=low
* New upstream release.
* New patch 99_nostrip.patch to remove stripping from src/Makefile to
get nostrip build option working (Closes: #438085).
* Update Standards-Version from 3.8.3 to 3.8.4. No change needed.

94
doc/Changelog

@ -1,3 +1,97 @@
sysvinit (2.88dsf) world; urgency=low
[ Petter Reinholdtsen ]
* Mention new home on Savannah in README.
* Revert change from Fedora/RedHat where the now obsolete command
INIT_CMD_CHANGECONS was introduced. Based on feedback and patch
from Bill Nottingham.
* Adjust makefile to make sure the install directories are created
before files are copied into them.
* Simplify build rules, based on patch from Mike Frysinger and Gentoo.
* Fix minor bug in optimizing of argument parsing. Based on
report from jakemus on freshmeat.
* Add casts to get rid of compiler warning about signed/unsigned issues.
* Change tty handling in init to make sure the UTF-8 flag is not cleared
on boot. Patch from Samuel Thibault.
* Add Makefile in toplevel directory.
* Print usage information when shutdown is used by non-root user.
Patch from Mike Frysinger and Gentoo.
* Sync shutdown manual page and usage information. Patch from Mike
Frysinger and Gentoo.
* Fix race condition in utmp writing. Patch from Gil Kloepfer via
Mike Frysinger and Gentoo.
* Rewrite findtty() in bootlogd to recursively search /dev/ for the
correct device, to handle terminal devices for example in /dev/pty/.
Patch from Debian.
* Make sure bootlogd findpty() returns an error value when it fails to
find a usable pty. Patch from Rob Leslie via Debian.
* Make sure bootlogd fflush() every line, even if asked not to flush
to disk using fdatasync(). Patch from Scott Gifford via Debian.
* Add compatibility code to handle old path "/etc/powerstatus" for a
while.
* Incude definition for MNT_DETACH which is missing in older GNU libc
headers.
* Do not strip binaries before installing them, to make it easier to
get binaries with debug information installed.
[ Werner Fink ]
* Add the comment from Andrea Arcangeli about the correct
place of setting the default childhandler within spawn().
* Make sure that newline is printed out for last(1) even
if an utmp record entry is truncated.
* Check if utmp not only exists but also is writable and delay
writing out of the utmp runlevel record if utmp is not writable.
* Be able to find libcrypt also on 64 bit based architectures.
* Add option -w to the last command to display the full user and
domain names in the output. Patch from Petr Lautrbach.
* Add a manual page for utmpdump as this tool is sometimes
very useful even if not intended for normal use.
* Use paths.h macros for wall
* Change path "/etc/powerstatus" to "/var/run/powerstatus"
* Detected also removable block devices at halt/reboot to be able
to flush data and send them the ATA standby command. This should
avoid data loss on USB sticks and other removable block devices.
* Flush block devices on halt/reboot if not done by the kernel.
* Set SHELL to /bin/sh in the environmant of shutdown.
* Retry to write out shutdown messages if interrupted.
* pidof/killall5 - make omit pid list a dynamic one.
* pidof - provide '-n' to skip stat(2) syscall on network based FS.
* init - avoid compiler warnings
* init - initialize console by using the macros from ttydefaults.h
* init - add the possiblity to ignore further interrupts from keyboard
* init - add the possiblity to set sane terminal line settings
* sulogin - add the possibility to reset the terminal io
* Fix some minor problems
* init - enable is_selinux_enabled() to detect selinuxfs
* Add fix for Debian bug #536574 -- Can be enabled by -DACCTON_OFF
* Add helper program fstab-decode to make it easier to handle
/etc/mtab content. Patch by Miloslav Trmac and Fedora.
* Add fix for Debian bug #335023 - Make sure TERM is set on FreeBSD.
* Add fix for Debian bug #374038 - Make it clear that shutdown -c can
only cancel a waiting shutdown, not an active one.
* Add note to pidof manual page about the use of readlink(2). Patch by
Bill Nottingham and Fedora.
* Add PAM patch contrib/notify-pam-dead.patch based on Debian bug
#68621, which will add PAM support for programs spawned by init on
the console like sulogin. Based on patch by Topi Miettinen. This
patch is not applied by default yet while we review its
usefullness. It is only helpful for session handling, as sulogin
do not use and will not use a PAM conv() function. The current
sulogin is able to handle DES as well as MD5, SHA, and Blowfish
encrypted passwords due using getpwnam(3).
* Move utmp/wtmp before the execvp() in spawn() to be sure to
use the correct pid even on a controlling tty
* Remaining problem is that the pid of the second fork() for
getting a controlling tty isn't that reported by spawn()
* Re-enable writting utmp/wtmp for boot scripts
* Extend sulogin to support additional encryption algorithms
* Re-enable maintenance message of sulogin
* Enable the sulogin fallback password check to handle MD5, SHA, and
Blowfish encrypted passwords in case of getpwnam(3) fails.
* sulogin picking the SELinux context was broken. Patch by Daniel Walsh
-- Petter Reinholdtsen <pere@hungry.com> Sun Apr 11 11:28:55 CEST 2010
sysvinit (2.87dsf) world; urgency=low
* Fix typos and do minor updates in the manual pages.

17
man/bootlogd.8

@ -1,3 +1,20 @@
'\" -*- coding: UTF-8 -*-
.\" Copyright (C) 1998-2003 Miquel van Smoorenburg.
.\"
.\" This program is free software; you can redistribute it and/or 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.
.\"
.\" This program is distributed in the hope that it will be useful,
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
.\" GNU General Public License for more details.
.\"
.\" You should have received a copy of the GNU General Public License
.\" along with this program; if not, write to the Free Software
.\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
.\"
.TH BOOTLOGD 8 "Jul 21, 2003" "" "Linux System Administrator's Manual"
.SH NAME
bootlogd \- record boot messages

17
man/bootlogd.8.todo

@ -1,3 +1,20 @@
'\" -*- coding: UTF-8 -*-
.\" Copyright (C) 1998-1999 Miquel van Smoorenburg.
.\"
.\" This program is free software; you can redistribute it and/or 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.
.\"
.\" This program is distributed in the hope that it will be useful,
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
.\" GNU General Public License for more details.
.\"
.\" You should have received a copy of the GNU General Public License
.\" along with this program; if not, write to the Free Software
.\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
.\"
.TH BOOTLOGD 8 "Aug 24, 1999" "" "Linux System Administrator's Manual"
.SH NAME
bootlogd \- record boot messages

45
man/fstab-decode.8

@ -0,0 +1,45 @@
.\" A man page for fstab-decode(8).
.\"
.\" Copyright (C) 2006 Red Hat, Inc. All rights reserved.
.\"
.\" This copyrighted material is made available to anyone wishing to use,
.\" modify, copy, or redistribute it subject to the terms and conditions of the
.\" GNU General Public License v.2.
.\"
.\" This program is distributed in the hope that it will be useful, but WITHOUT
.\" ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
.\" FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
.\" more details.
.\"
.\" You should have received a copy of the GNU General Public License along
.\" with this program; if not, write to the Free Software Foundation, Inc.,
.\" 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
.\"
.\" Author: Miloslav Trmac <mitr@redhat.com>
.TH fstab-decode 8 "May 2006"
.SH NAME
fstab-decode \- run a command with fstab-encoded arguments
.SH SYNOPSIS
\fB fstab-decode\fR \fICOMMAND\fR [\fIARGUMENT\fR]...
.SH DESCRIPTION
.B fstab-decode
decodes escapes in the specified \FIARGUMENT\fRs
and uses them to run \fICOMMAND\fR.
The argument escaping uses the same rules as path escaping in
\fB/etc/fstab\fR,
.B /etc/mtab
and \fB/proc/mtab\fR.
.SH EXIT STATUS
.B fstab-decode
exits with status 127 if
.I COMMAND
can't be run.
Otherwise it exits with the status returned by \fICOMMAND\fR.
.SH EXAMPLES
.B fstab-decode umount $(awk '$3 == "vfat" { print $2 }' /etc/fstab)

17
man/halt.8

@ -1,3 +1,20 @@
'\" -*- coding: UTF-8 -*-
.\" Copyright (C) 1998-2001 Miquel van Smoorenburg.
.\"
.\" This program is free software; you can redistribute it and/or 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.
.\"
.\" This program is distributed in the hope that it will be useful,
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
.\" GNU General Public License for more details.
.\"
.\" You should have received a copy of the GNU General Public License
.\" along with this program; if not, write to the Free Software
.\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
.\"
.\"{{{}}}
.\"{{{ Title
.TH HALT 8 "Nov 6, 2001" "" "Linux System Administrator's Manual"

17
man/init.8

@ -1,3 +1,20 @@
'\" -*- coding: UTF-8 -*-
.\" Copyright (C) 1998-2004 Miquel van Smoorenburg.
.\"
.\" This program is free software; you can redistribute it and/or 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.
.\"
.\" This program is distributed in the hope that it will be useful,
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
.\" GNU General Public License for more details.
.\"
.\" You should have received a copy of the GNU General Public License
.\" along with this program; if not, write to the Free Software
.\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
.\"
.\"{{{}}}
.\"{{{ Title
.TH INIT 8 "29 Jul 2004" "" "Linux System Administrator's Manual"

17
man/initscript.5

@ -1,3 +1,20 @@
'\" -*- coding: UTF-8 -*-
.\" Copyright (C) 1998-2003 Miquel van Smoorenburg.
.\"
.\" This program is free software; you can redistribute it and/or 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.
.\"
.\" This program is distributed in the hope that it will be useful,
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
.\" GNU General Public License for more details.
.\"
.\" You should have received a copy of the GNU General Public License
.\" along with this program; if not, write to the Free Software
.\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
.\"
.TH INITSCRIPT 5 "July 10, 2003" "" "Linux System Administrator's Manual"
.SH NAME
initscript \- script that executes inittab commands.

17
man/inittab.5

@ -1,3 +1,20 @@
'\" -*- coding: UTF-8 -*-
.\" Copyright (C) 1998-2001 Miquel van Smoorenburg.
.\"
.\" This program is free software; you can redistribute it and/or 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.
.\"
.\" This program is distributed in the hope that it will be useful,
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
.\" GNU General Public License for more details.
.\"
.\" You should have received a copy of the GNU General Public License
.\" along with this program; if not, write to the Free Software
.\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
.\"
.\"{{{}}}
.\"{{{ Title
.TH INITTAB 5 "Dec 4, 2001" "" "Linux System Administrator's Manual"

21
man/killall5.8

@ -1,3 +1,20 @@
'\" -*- coding: UTF-8 -*-
.\" Copyright (C) 1998-2003 Miquel van Smoorenburg.
.\"
.\" This program is free software; you can redistribute it and/or 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.
.\"
.\" This program is distributed in the hope that it will be useful,
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
.\" GNU General Public License for more details.
.\"
.\" You should have received a copy of the GNU General Public License
.\" along with this program; if not, write to the Free Software
.\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
.\"
.TH KILLALL5 8 "04 Nov 2003" "" "Linux System Administrator's Manual"
.SH NAME
killall5 -- send a signal to all processes.
@ -5,9 +22,9 @@ killall5 -- send a signal to all processes.
.B killall5
.RB -signalnumber
.RB [ \-o
.IR omitpid ]
.IR omitpid[,omitpid..]]
.RB [ \-o
.IR omitpid.. ]
.IR omitpid[,omitpid..].. ]
.SH DESCRIPTION
.B killall5
is the SystemV killall command. It sends a signal to all processes except

23
man/last.1

@ -1,3 +1,20 @@
'\" -*- coding: UTF-8 -*-
.\" Copyright (C) 1998-2004 Miquel van Smoorenburg.
.\"
.\" This program is free software; you can redistribute it and/or 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.
.\"
.\" This program is distributed in the hope that it will be useful,
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
.\" GNU General Public License for more details.
.\"
.\" You should have received a copy of the GNU General Public License
.\" along with this program; if not, write to the Free Software
.\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
.\"
.\"{{{}}}
.\"{{{ Title
.TH LAST,LASTB 1 "Jul 31, 2004" "" "Linux System Administrator's Manual"
@ -12,7 +29,7 @@ last, lastb \- show listing of last logged in users
.RB [ \-R ]
.RB [ \-\fInum\fP ]
.RB "[ \-\fBn\fP \fInum\fP ]"
.RB [ \-adFiox ]
.RB [ \-adFiowx ]
.RB "[ \-\fBf\fP \fIfile\fP ]"
.RB "[ \-\fBt\fP \fIYYYYMMDDHHMMSS\fP ]"
.RI [ name... ]
@ -23,7 +40,7 @@ last, lastb \- show listing of last logged in users
.RB [ \-\fInum\fP ]
.RB "[ \-\fBn\fP \fInum\fP ]"
.RB "[ \-\fBf\fP \fIfile\fP ]"
.RB [ \-adFiox ]
.RB [ \-adFiowx ]
.RI [ name... ]
.RI [ tty... ]
.\"}}}
@ -78,6 +95,8 @@ This option is like \fB-d\fP in that it displays the IP number of the remote
host, but it displays the IP number in numbers-and-dots notation.
.IP \fB\-o\fP
Read an old-type wtmp file (written by linux-libc5 applications).
.IP \fB\-w\fP
Display full user and domain names in the output.
.IP \fB\-x\fP
Display the system shutdown entries and run level changes.
.\"}}}

17
man/mesg.1

@ -1,3 +1,20 @@
'\" -*- coding: UTF-8 -*-
.\" Copyright (C) 1998-2001 Miquel van Smoorenburg.
.\"
.\" This program is free software; you can redistribute it and/or 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.
.\"
.\" This program is distributed in the hope that it will be useful,
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
.\" GNU General Public License for more details.
.\"
.\" You should have received a copy of the GNU General Public License
.\" along with this program; if not, write to the Free Software
.\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
.\"
.\"{{{}}}
.\"{{{ Title
.TH MESG 1 "Feb 26, 2001" "" "Linux User's Manual"

17
man/mountpoint.1

@ -1,3 +1,20 @@
'\" -*- coding: UTF-8 -*-
.\" Copyright (C) 1998-2004 Miquel van Smoorenburg.
.\"
.\" This program is free software; you can redistribute it and/or 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.
.\"
.\" This program is distributed in the hope that it will be useful,
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
.\" GNU General Public License for more details.
.\"
.\" You should have received a copy of the GNU General Public License
.\" along with this program; if not, write to the Free Software
.\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
.\"
.TH MOUNTPOINT 1 "Mar 15, 2004" "" "Linux System Administrator's Manual"
.SH NAME
mountpoint \- see if a directory is a mountpoint

43
man/pidof.8

@ -1,3 +1,20 @@
'\" -*- coding: UTF-8 -*-
.\" Copyright (C) 1998 Miquel van Smoorenburg.
.\"
.\" This program is free software; you can redistribute it and/or 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.
.\"
.\" This program is distributed in the hope that it will be useful,
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
.\" GNU General Public License for more details.
.\"
.\" You should have received a copy of the GNU General Public License
.\" along with this program; if not, write to the Free Software
.\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
.\"
.TH PIDOF 8 "01 Sep 1998" "" "Linux System Administrator's Manual"
.SH NAME
pidof -- find the process ID of a running program.
@ -5,11 +22,12 @@ pidof -- find the process ID of a running program.
.B pidof
.RB [ \-s ]
.RB [ \-c ]
.RB [ \-n ]
.RB [ \-x ]
.RB [ \-o
.IR omitpid ]
.IR omitpid[,omitpid..] ]
.RB [ \-o
.IR omitpid.. ]
.IR omitpid[,omitpid..].. ]
.B program
.RB [ program.. ]
.SH DESCRIPTION
@ -23,13 +41,22 @@ a
.B start-stop-daemon
(8) program that should be used instead.
.SH OPTIONS
.IP -s
.IP \-s
Single shot - this instructs the program to only return one \fIpid\fP.
.IP -c
.IP \-c
Only return process ids that are running with the same root directory.
This option is ignored for non-root users, as they will be unable to check
the current root directory of processes they do not own.
.IP -x
.IP \-n
Avoid
.BR stat (2)
system function call on all binaries which are located on network
based file systems like
.BR NFS .
Instead of using this option the the variable
.B PIDOF_NETFS
may be set and exported.
.IP \-x
Scripts too - this causes the program to also return process id's of
shells running the named scripts.
.IP "-o \fIomitpid\fP"
@ -50,7 +77,11 @@ the program behaves according to the name under which it is called.
When \fIpidof\fP is invoked with a full pathname to the program it
should find the pid of, it is reasonably safe. Otherwise it is possible
that it returns pids of running programs that happen to have the same name
as the program you're after but are actually other programs.
as the program you're after but are actually other programs. Note that
that the executable name of running processes is calculated with
.BR readlink (2),
so symbolic links to executables will also match.
.SH SEE ALSO
.BR shutdown (8),
.BR init (8),

17
man/runlevel.8

@ -1,3 +1,20 @@
'\" -*- coding: UTF-8 -*-
.\" Copyright (C) 1997 Miquel van Smoorenburg.
.\"
.\" This program is free software; you can redistribute it and/or 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.
.\"
.\" This program is distributed in the hope that it will be useful,
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
.\" GNU General Public License for more details.
.\"
.\" You should have received a copy of the GNU General Public License
.\" along with this program; if not, write to the Free Software
.\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
.\"
.TH RUNLEVEL 8 "May 27, 1997" "" "Linux System Administrator's Manual"
.SH NAME
runlevel -- find the previous and current system runlevel.

60
man/shutdown.8

@ -1,3 +1,20 @@
'\" -*- coding: UTF-8 -*-
.\" Copyright (C) 1998-2003 Miquel van Smoorenburg.
.\"
.\" This program is free software; you can redistribute it and/or 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.
.\"
.\" This program is distributed in the hope that it will be useful,
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
.\" GNU General Public License for more details.
.\"
.\" You should have received a copy of the GNU General Public License
.\" along with this program; if not, write to the Free Software
.\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
.\"
.\"{{{}}}
.\"{{{ Title
.TH SHUTDOWN 8 "November 12, 2003" "" "Linux System Administrator's Manual"
@ -9,11 +26,11 @@ shutdown \- bring the system down
.\"{{{ Synopsis
.SH SYNOPSIS
.B /sbin/shutdown
.RB [ \-akrhPHfFnc ]
.RB [ \-t
.IR sec ]
.RB [ \-arkhncfFHP ]
.I time
.RI [ warning-message ]
.RI [ "warning message" ]
.\"}}}
.\"{{{ Description
.SH DESCRIPTION
@ -39,11 +56,6 @@ entries for these runlevels in the file \fI/etc/inittab\fP.
.IP "\fB\-a\fP
Use \fB/etc/shutdown.allow\fP.
.\"}}}
.\"{{{ -t sec
.IP "\fB\-t\fP \fIsec\fP"
Tell \fBinit\fP(8) to wait \fIsec\fP seconds between sending processes the
warning and the kill signal, before changing to another runlevel.
.\"}}}
.\"{{{ -k
.IP \fB\-k\fP
Don't really shutdown; only send the warning messages to everybody.
@ -56,20 +68,14 @@ Reboot after shutdown.
.IP \fB\-h\fP
Halt or power off after shutdown.
.\"}}}
.\"{{{ -H
.IP \fB\-H\fP
Modifier to the -h flag. Halt action is to halt or drop into boot
monitor on systems that support it. Must be used with the -h flag.
.\"}}}
.\"{{{ -P
.IP \fB\-P\fP
Halt action is to turn off the power.
.\"}}}
.\"{{{ -n
.IP \fB\-n\fP
[DEPRECATED] Don't call \fBinit\fP(8) to do the shutdown but do it ourself.
The use of this option is discouraged, and its results are not always what
you'd expect.
.\"{{{ -H
.IP \fB\-H\fP
Modifier to the -h flag. Halt action is to halt or drop into boot
monitor on systems that support it. Must be used with the -h flag.
.\"}}}
.\"{{{ -f
.IP \fB\-f\fP
@ -79,18 +85,30 @@ Skip fsck on reboot.
.IP \fB\-F\fP
Force fsck on reboot.
.\"}}}
.\"{{{ -n
.IP \fB\-n\fP
[DEPRECATED] Don't call \fBinit\fP(8) to do the shutdown but do it ourself.
The use of this option is discouraged, and its results are not always what
you'd expect.
.\"}}}
.\"{{{ -c
.IP \fB\-c\fP
Cancel an already running shutdown. With this option it is of course
not possible to give the \fBtime\fP argument, but you can enter a
explanatory message on the command line that will be sent to all users.
Cancel a waiting shutdown. ("shutdown now" is no longer waiting.) With
this option it is of course not possible to give the time argument, but
you can enter explanatory message arguments on the command line that
will be sent to all users.
.\"}}}
.\"{{{ -t sec
.IP "\fB\-t\fP \fIsec\fP"
Tell \fBinit\fP(8) to wait \fIsec\fP seconds between sending processes the
warning and the kill signal, before changing to another runlevel.
.\"}}}
.\"{{{ time
.IP \fItime\fP
When to shutdown.
.\"}}}
.\"{{{ warning-message
.IP \fIwarning-message\fP
.IP "\fIwarning message\fP"
Message to send to all users.
.\"}}}
.PP

17
man/sulogin.8

@ -1,3 +1,20 @@
'\" -*- coding: UTF-8 -*-
.\" Copyright (C) 1998-2006 Miquel van Smoorenburg.
.\"
.\" This program is free software; you can redistribute it and/or 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.
.\"
.\" This program is distributed in the hope that it will be useful,
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
.\" GNU General Public License for more details.
.\"
.\" You should have received a copy of the GNU General Public License
.\" along with this program; if not, write to the Free Software
.\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
.\"
.TH SULOGIN 8 "17 Jan 2006" "" "Linux System Administrator's Manual"
.SH NAME
sulogin \- Single-user login

66
man/utmpdump.1

@ -0,0 +1,66 @@
'\" -*- coding: UTF-8 -*-
.\" Copyright (C) 2010 Michael Krapp
.\"
.\" This program is free software; you can redistribute it and/or 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.
.\"
.\" This program is distributed in the hope that it will be useful,
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
.\" GNU General Public License for more details.
.\"
.\" You should have received a copy of the GNU General Public License
.\" along with this program; if not, write to the Free Software
.\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
.\"
.TH UTMPDUMP 1 "Februar 8, 2010" "" "Linux System Administrator's Manual"
.SH NAME
utmpdump \- dump UTMP and WTMP files in raw format
.SH SYNOPSIS
.B utmpdump
.RB [ \-froh ]
.I filename
.SH DESCRIPTION
\fButmpdump\fP is a simple program to dump UTMP and WTMP files
in raw format, so they can be examined.
.SH OPTIONS
.IP \fB\-f\fP
output appended data as the file grows.
.IP "\fB\-r\fP"
reverse. Write back edited login information into utmp or wtmp files.
.IP \fB\-o\fP
use old libc5 format.
.IP \fB\-h\fP
usage information.
.PP
utmpdump can be useful in cases of corrupted utmp or wtmp entries.
It can dump out utmp/wtmp to an ASCII file, then that file can
be edited to remove bogus entries and reintegrated, using
.PP
.sp 1
.in +1c
.nf
\fButmpdump -r < ascii file > wtmp\fP
.fi
.in -1c
.sp 1
but be warned as
.B utmpdump
was written for debugging purpose only.
.SH BUGS
You may
.B not
use the option \fB\-r\fP as the format for the
utmp/wtmp files strongly depends on the
input format. This tool was
.B not
written for normal use but for debugging.
.SH AUTHOR
Michael Krapp
.SH "SEE ALSO"
.BR last (1),
.BR w (1),
.BR who (1),
.BR utmp (5),

17
man/wall.1

@ -1,3 +1,20 @@
'\" -*- coding: UTF-8 -*-
.\" Copyright (C) 1998-2003 Miquel van Smoorenburg.
.\"
.\" This program is free software; you can redistribute it and/or 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.
.\"
.\" This program is distributed in the hope that it will be useful,
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
.\" GNU General Public License for more details.
.\"
.\" You should have received a copy of the GNU General Public License
.\" along with this program; if not, write to the Free Software
.\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
.\"
.TH WALL 1 "15 April 2003" "" "Linux User's Manual"
.SH NAME

17
obsolete/powerd.8

@ -1,3 +1,20 @@
'\" -*- coding: UTF-8 -*-
.\" Copyright (C) 1994 Miquel van Smoorenburg.
.\"
.\" This program is free software; you can redistribute it and/or 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.
.\"
.\" This program is distributed in the hope that it will be useful,
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
.\" GNU General Public License for more details.
.\"
.\" You should have received a copy of the GNU General Public License
.\" along with this program; if not, write to the Free Software
.\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
.\"
.TH POWERD 8 "Feb 14, 1994" "" "Linux System Administrator's Manual"
.SH NAME
.\" powerd \(em monitor a serial line connected to an UPS.

19
obsolete/powerd.c

@ -22,12 +22,21 @@
* who has given kind permission to release this program
* for general puppose.
*
* Copyright 1991-1996 Cistron Electronics.
* Copyright (C) 1991-1996 Cistron Electronics.
*
* This program is free software; you can redistribute it and/or
* 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.
* This program is free software; you can redistribute it and/or 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.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/* Use the new way of communicating with init. */

19
obsolete/utmpdump.c.OLD

@ -5,12 +5,21 @@
* Version: @(#)utmpdump.c 13-Aug-1996 1.00 miquels@cistron.nl
*
* This file is part of the sysvinit suite,
* Copyright 1991-1996 Miquel van Smoorenburg.
* Copyright (C) 1991-1996 Miquel van Smoorenburg.
*
* This program is free software; you can redistribute it and/or
* 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.
* This program is free software; you can redistribute it and/or 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.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <stdio.h>

91
src/Makefile

@ -8,30 +8,31 @@
# Version: @(#)Makefile 2.85-13 23-Mar-2004 miquels@cistron.nl
#
CC = gcc
CFLAGS = -ansi -W -Wall -O2 -fomit-frame-pointer -D_GNU_SOURCE
LDFLAGS = -s
CPPFLAGS =
CFLAGS ?= -ansi -O2 -fomit-frame-pointer
override CFLAGS += -W -Wall -D_GNU_SOURCE
STATIC =
# For some known distributions we do not build all programs, otherwise we do.
BIN =
SBIN = init halt shutdown runlevel killall5
SBIN = init halt shutdown runlevel killall5 fstab-decode
USRBIN = last mesg
MAN1 = last.1 lastb.1 mesg.1
MAN5 = initscript.5 inittab.5
MAN8 = halt.8 init.8 killall5.8 pidof.8 poweroff.8 reboot.8 runlevel.8
MAN8 += shutdown.8 telinit.8
MAN8 += shutdown.8 telinit.8 fstab-decode.8
ifeq ($(DISTRO),)
BIN += mountpoint
SBIN += sulogin bootlogd
USRBIN += utmpdump wall
MAN1 += mountpoint.1 wall.1
MAN1 += utmpdump.1 mountpoint.1 wall.1
MAN8 += sulogin.8 bootlogd.8
endif
ifeq ($(DISTRO),Debian)
CPPFLAGS+= -DACCTON_OFF
BIN += mountpoint
SBIN += sulogin bootlogd
MAN1 += mountpoint.1
@ -43,77 +44,87 @@ USRBIN += wall
MAN1 += wall.1
endif
ifeq ($(DISTRO),SuSE)
CPPFLAGS+= -DUSE_SYSFS -DSANE_TIO -DSIGINT_ONLYONCE -DUSE_ONELINE
BIN += mountpoint
SBIN += sulogin
USRBIN += utmpdump
MAN1 += utmpdump.1 mountpoint.1
MAN8 += sulogin.8
endif
ID = $(shell id -u)
BIN_OWNER = root
BIN_GROUP = root
BIN_COMBO = $(BIN_OWNER):$(BIN_GROUP)
STRIP = strip -s -R .comment
INSTALL_EXEC = install -o $(BIN_OWNER) -g $(BIN_GROUP) -m 755
INSTALL_DATA = install -o $(BIN_OWNER) -g $(BIN_GROUP) -m 644
ifeq ($(ID),0)
INSTALL_EXEC = install -o $(BIN_OWNER) -g $(BIN_GROUP) -m 755
INSTALL_DATA = install -o $(BIN_OWNER) -g $(BIN_GROUP) -m 644
else
INSTALL_EXEC = install -m 755
INSTALL_DATA = install -m 644
endif
INSTALL_DIR = install -m 755 -d
MANDIR = /usr/share/man
ifeq ($(WITH_SELINUX),yes)
SELINUX_DEF=-DWITH_SELINUX
INIT_SELIBS=-lsepol -lselinux
SULOGIN_SELIBS=-lselinux
SELINUX_DEF = -DWITH_SELINUX
INITLIBS += -lsepol -lselinux
SULOGINLIBS = -lselinux
else
SELINUX_DEF=
INIT_SELIBS=
SULOGIN_SELIBS=
SELINUX_DEF =
INITLIBS =
SULOGINLIBS =
endif
# Additional libs for GNU libc.
ifneq ($(wildcard /usr/lib/libcrypt.a),)
LCRYPT = -lcrypt
ifneq ($(wildcard /usr/lib*/libcrypt.a),)
SULOGINLIBS += -lcrypt
endif
all: $(BIN) $(SBIN) $(USRBIN)
#%: %.o
# $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS)
#%.o: %.c
# $(CC) $(CFLAGS) $(CPPFLAGS) -c $^ -o $@
init: LDLIBS += $(INITLIBS) $(STATIC)
init: init.o init_utmp.o
$(CC) $(LDFLAGS) $(STATIC) -o $@ init.o init_utmp.o $(INIT_SELIBS)
halt: halt.o ifdown.o hddown.o utmp.o reboot.h
$(CC) $(LDFLAGS) -o $@ halt.o ifdown.o hddown.o utmp.o
last: last.o oldutmp.h
$(CC) $(LDFLAGS) -o $@ last.o
mesg: mesg.o
$(CC) $(LDFLAGS) -o $@ mesg.o
mountpoint: mountpoint.o
$(CC) $(LDFLAGS) -o $@ mountpoint.o
utmpdump: utmpdump.o
$(CC) $(LDFLAGS) -o $@ utmpdump.o
runlevel: runlevel.o
$(CC) $(LDFLAGS) -o $@ runlevel.o
sulogin: LDLIBS += $(SULOGINLIBS) $(STATIC)
sulogin: sulogin.o
$(CC) $(LDFLAGS) $(STATIC) $(SELINUX_DEF) -o $@ $^ $(LCRYPT) $(SULOGIN_SELIBS)
wall: dowall.o wall.o
$(CC) $(LDFLAGS) -o $@ dowall.o wall.o
shutdown: dowall.o shutdown.o utmp.o reboot.h
$(CC) $(LDFLAGS) -o $@ dowall.o shutdown.o utmp.o
bootlogd: LDLIBS += -lutil
bootlogd: bootlogd.o
$(CC) $(LDFLAGS) -o $@ bootlogd.o -lutil
sulogin.o: CPPFLAGS += $(SELINUX_DEF)
sulogin.o: sulogin.c
$(CC) -c $(CFLAGS) $(SELINUX_DEF) sulogin.c
init.o: CPPFLAGS += $(SELINUX_DEF)
init.o: init.c init.h set.h reboot.h initreq.h
$(CC) -c $(CFLAGS) $(SELINUX_DEF) init.c
utmp.o: utmp.c init.h
$(CC) -c $(CFLAGS) utmp.c
init_utmp.o: CPPFLAGS += -DINIT_MAIN
init_utmp.o: utmp.c init.h
$(CC) -c $(CFLAGS) -DINIT_MAIN utmp.c -o init_utmp.o
$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
cleanobjs:
rm -f *.o *.bak
@ -127,19 +138,19 @@ clobber: cleanobjs
distclean: clobber
install:
$(INSTALL_DIR) $(ROOT)/bin/ $(ROOT)/sbin/
$(INSTALL_DIR) $(ROOT)/usr/bin/
for i in $(BIN); do \
$(STRIP) $$i ; \
$(INSTALL_EXEC) $$i $(ROOT)/bin/ ; \
done
for i in $(SBIN); do \
$(STRIP) $$i ; \
$(INSTALL_EXEC) $$i $(ROOT)/sbin/ ; \
done
for i in $(USRBIN); do \
$(STRIP) $$i ; \
$(INSTALL_EXEC) $$i $(ROOT)/usr/bin/ ; \
done
# $(INSTALL_EXEC) etc/initscript.sample $(ROOT)/etc/
# $(INSTALL_DIR) $(ROOT)/etc/
# $(INSTALL_EXEC) initscript.sample $(ROOT)/etc/
ln -sf halt $(ROOT)/sbin/reboot
ln -sf halt $(ROOT)/sbin/poweroff
ln -sf init $(ROOT)/sbin/telinit
@ -147,7 +158,11 @@ install:
if [ ! -f $(ROOT)/usr/bin/lastb ]; then \
ln -sf last $(ROOT)/usr/bin/lastb; \
fi
$(INSTALL_DIR) $(ROOT)/usr/include/
$(INSTALL_DATA) initreq.h $(ROOT)/usr/include/
$(INSTALL_DIR) $(ROOT)$(MANDIR)/man1/
$(INSTALL_DIR) $(ROOT)$(MANDIR)/man5/
$(INSTALL_DIR) $(ROOT)$(MANDIR)/man8/
for i in $(MAN1); do \
$(INSTALL_DATA) ../man/$$i $(ROOT)$(MANDIR)/man1/; \
done

106
src/bootlogd.c

@ -8,12 +8,21 @@
* Bugs: Uses openpty(), only available in glibc. Sorry.
*
* This file is part of the sysvinit suite,
* Copyright 1991-2004 Miquel van Smoorenburg.
* Copyright (C) 1991-2004 Miquel van Smoorenburg.
*
* This program is free software; you can redistribute it and/or
* 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.
* This program is free software; you can redistribute it and/or 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.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* *NOTE* *NOTE* *NOTE*
* This is a PROOF OF CONCEPT IMPLEMENTATION
@ -98,41 +107,60 @@ void handler(int sig)
/*
* Scan /dev and find the device name.
* Side-effect: directory is changed to /dev
*
* FIXME: scan subdirectories for devfs support ?
*/
int findtty(char *res, int rlen, dev_t dev)
static int findtty(char *res, const char *startdir, int rlen, dev_t dev)
{
DIR *dir;
struct dirent *ent;
struct stat st;
int r = 0;
if (chdir("/dev") < 0 || (dir = opendir(".")) == NULL) {
perror("bootlogd: /dev");
int r