From 2e1f87635ec65e9d6ad893d4f3677a676b217aa3 Mon Sep 17 00:00:00 2001 From: Jesse Smith Date: Thu, 22 Feb 2018 21:07:51 -0400 Subject: [PATCH 1/4] Removed extra sleep() calls from shutting down process since we use sync() anyway to pause and make sure data is written out to disk. --- doc/Changelog | 2 ++ src/halt.c | 6 +++++- src/shutdown.c | 3 ++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/doc/Changelog b/doc/Changelog index a8be14e..a6b73c6 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,6 +1,8 @@ sysvinit (2.89) UNRELEASED; urgency=low [ Jesse Smith ] + * Removed two sleep calls when we are doing sync anyway to make sure + data is being written. Speeds up reboot time by about two seconds. * Fixed Clang compiler warning regarding variable data parameters to sprintf(). * Updated top-level Makefile to work with git repo instead of old svn repo. * Removed unused variables and findtty() function in bootlogd diff --git a/src/halt.c b/src/halt.c index 5b9430c..7dbafa2 100644 --- a/src/halt.c +++ b/src/halt.c @@ -266,7 +266,11 @@ int main(int argc, char **argv) if (do_sync) { sync(); - sleep(2); + /* Sync should be fine on its own for making sure data is written. + We probably call shutdown after this anyway to clean up. + -- Jesse + sleep(2); + */ } if (do_ifdown) diff --git a/src/shutdown.c b/src/shutdown.c index f85bc38..1208c57 100644 --- a/src/shutdown.c +++ b/src/shutdown.c @@ -359,7 +359,8 @@ void fastdown() #endif /* script failed or not present: do it ourself. */ - sleep(1); /* Give init the chance to collect zombies. */ + /* Give init the chance to collect zombies. */ + /* sleep(1); */ /* Record the fact that we're going down */ write_wtmp("shutdown", "~~", 0, RUN_LVL, "~~"); From d6f9d19745ef9d5019de0cb0e24088e67e0afefa Mon Sep 17 00:00:00 2001 From: Jesse Smith Date: Fri, 23 Feb 2018 18:08:34 -0400 Subject: [PATCH 2/4] Updated Makefile to sign and upload packages created from the git repository when we use "make upload". --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index ad8f444..052faa2 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ all install clean distclean: PACKAGE=sysvinit VERSION=$(shell sed -rn '1s/.*[[:blank:]]\((.*)\)[[:blank:]].*/\1/p' doc/Changelog) -SVLOGIN=$(shell svn info | sed -rn '/Repository Root:/{ s|.*//(.*)\@.*|\1|p }') +GITLOGIN=$(shell git remote -v | head -n 1 | cut -f 3 -d '/' | cut -f 1 -d '@') override TMP:=$(shell mktemp -d $(VERSION).XXXXXXXX) override TARBALL:=$(TMP)/$(PACKAGE)-$(VERSION).tar.bz2 override SFTPBATCH:=$(TMP)/$(VERSION)-sftpbatch @@ -15,7 +15,7 @@ dist: $(TARBALL) rm -rf $(TMP) upload: $(SFTPBATCH) - echo @sftp -b $< $(SVLOGIN)@dl.sv.nongnu.org:/releases/$(PACKAGE) + echo @sftp -b $< $(GITLOGIN)@dl.sv.nongnu.org:/releases/$(PACKAGE) rm -rf $(TMP) $(SFTPBATCH): $(TARBALL).sig From a3f38afc34cf8cf8a5411e03ae9186d9588040b9 Mon Sep 17 00:00:00 2001 From: Jesse Smith Date: Tue, 27 Feb 2018 17:28:10 -0400 Subject: [PATCH 3/4] Updated documentation and install instructions. Refreshed copyright notice. --- COPYRIGHT | 3 ++- README | 12 +++++---- contrib/start-stop-daemon.README | 6 ++--- contrib/start-stop-daemon.c | 45 ++++++++++++++++---------------- doc/Install | 37 +++++++++++++++++++------- doc/Propaganda | 26 +++++++----------- doc/sysvinit-2.86.lsm | 10 +++---- 7 files changed, 75 insertions(+), 64 deletions(-) diff --git a/COPYRIGHT b/COPYRIGHT index d44645b..a208043 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -1,4 +1,5 @@ Sysvinit is Copyright (C) 1991-2004 Miquel van Smoorenburg + Updated Copyright (C) 2018 Jesse Smith 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 @@ -19,7 +20,7 @@ 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 +Regarding the start-stop-daemon located in the contrib directory: * A rewrite of the original Debian's start-stop-daemon Perl script * in C (faster - it is executed many times during system startup). diff --git a/README b/README index 58e958e..ff1f699 100644 --- a/README +++ b/README @@ -1,10 +1,12 @@ -contrib Unofficial stuff -doc Documentation, mostly obsolete -man Manual pages, not obsolete -obsolete Really obsolete stuff ;) +contrib Unofficial stuff, add-on programs +doc Documentation +man Manual pages src Source code -The project home is on https://savannah.nongnu.org/projects/sysvinit . +For instructions on building and installing SysV init, please +see the "doc/Install" file. + +The project home is on https://savannah.nongnu.org/projects/sysvinit Send patches to sysvinit-devel@nongnu.org . diff --git a/contrib/start-stop-daemon.README b/contrib/start-stop-daemon.README index fb69c08..6ce7710 100644 --- a/contrib/start-stop-daemon.README +++ b/contrib/start-stop-daemon.README @@ -1,10 +1,10 @@ -Start-stop-daemon is the program that is used by the DEBIAN style init +Start-stop-daemon is the program that is used by the Debian style init scripts to start and stop services. This program is part of the "dpkg" package by Ian Jackson. However there is also a seperate C version (the -original is in perl) available written by Marek Michalkiewicz. I'm including +original is in Perl) available written by Marek Michalkiewicz. I am including it for your convinience. -Note that the latest debian dpkg packages (4.0.18 and later) contain +Note that the latest Debian dpkg packages (4.0.18 and later) contain a much improved update-rc.d. This code is almost a year old. The original announcement follows: diff --git a/contrib/start-stop-daemon.c b/contrib/start-stop-daemon.c index ce286a2..838154b 100644 --- a/contrib/start-stop-daemon.c +++ b/contrib/start-stop-daemon.c @@ -107,29 +107,28 @@ push(struct pid_list **list, int pid) static void do_help(void) { - printf("\ -start-stop-daemon for Debian Linux - small and fast C version written by\n\ -Marek Michalkiewicz , public domain.\n" -VERSION "\n\ -\n\ -Usage: - start-stop-daemon -S|--start options ... -- arguments ...\n\ - start-stop-daemon -K|--stop options ...\n\ - start-stop-daemon -H|--help\n\ - start-stop-daemon -V|--version\n\ -\n\ -Options (at least one of --exec|--pidfile|--user is required): - -x|--exec program to start/check if it is running\n\ - -p|--pidfile pid file to check\n\ - -u|--user | stop this user's processes\n\ - -n|--name stop processes with this name\n\ - -s|--signal signal to send (default 15)\n\ - -a|--startas program to start (default )\n\ - -t|--test test mode, don't do anything\n\ - -o|--oknodo exit status 0 (not 1) if nothing done\n\ - -q|--quiet | -v, --verbose\n\ -\n\ -Exit status: 0 = done 1 = nothing done (=> 0 if --oknodo) 2 = trouble\n"); +printf("start-stop-daemon for Debian Linux - small and fast C version written by\n" +"Marek Michalkiewicz , public domain. %s\n" +"\n" +"Usage:\n" +" start-stop-daemon -S|--start options ... -- arguments ...\n" +" start-stop-daemon -K|--stop options ...\n" +" start-stop-daemon -H|--help\n" +" start-stop-daemon -V|--version\n" +"\n" +"Options (at least one of --exec|--pidfile|--user is required):\n" +" -x|--exec program to start/check if it is running\n" +" -p|--pidfile pid file to check\n" +" -u|--user | stop this user's processes\n" +" -n|--name stop processes with this name\n" +" -s|--signal signal to send (default 15)\n" +" -a|--startas program to start (default )\n" +" -t|--test test mode, don't do anything\n" +" -o|--oknodo exit status 0 (not 1) if nothing done\n" +" -q|--quiet | -v, --verbose\n" +"\n" +"Exit status: 0 = done 1 = nothing done (=> 0 if --oknodo) 2 = trouble\n", +VERSION); } diff --git a/doc/Install b/doc/Install index fdd25fc..201923a 100644 --- a/doc/Install +++ b/doc/Install @@ -1,18 +1,36 @@ - README for the System V style init, version 2.86 + README for the System V style init, version 2.89 init, shutdown, halt, reboot, wall, last, mesg, runlevel, killall5, pidof, sulogin. All programs, files and scripts in this package are covered by -the Gnu Public License, and copyrighted by me. +the GNU General Public License version 2, and copyrighted by +Miquel van Smoorenburg (1991-2004) and, Jesse Smith (2018). If you are not using Debian and the debianized package, -you will have to install the new init by hand. You should -be able to drop the binaries into a Slackware or Redhat -system, I think. +you may have to install the new init by hand if Debian is +using an init system other than SysV (eg systemd). You should +be able to drop the binaries into a Slackware or Devuan system, I think. -Here is a list of preferred directories to install the progs & manpages: +The SysV init software, core programs and manual pages can be +installed by running the following two commands from the top-level +source directory. + +make +sudo make install + +If sudo is not installed, the "make install" command may be run as +the root user. + +Other than the GNU make utility, SysV init has few dependencies. +SysV can be built on virtually any Linux system featuring +the GNU C library or musl libc. A C compiler, such as the GNU Compiler +Collection (GCC) or Clang is also required. + +Here is a list of preferred directories to install the progs & manpages, +this should be done for you automatically when you run "make install" +as the root user, or via sudo, ie "sudo make install". wall.1, last.1, mesg.1 /usr/man/man1 inittab.5, initscript.5 /usr/man/man5 @@ -40,7 +58,7 @@ bootlogd /sbin/bootlogd utmpdump don't install, it's just a debug thingy. If you already _have_ a "wall" in /bin (the SLS release had, for example) -do _not_ install this wall. Chances are that the wall you are already +do _not_ install this version of wall. Chances are that the wall you are already using is linked to /bin/write. Either first _remove_ /bin/wall before installing the new one, or don't install the new one at all. @@ -48,9 +66,8 @@ You might want to create a file called "/etc/shutdown.allow". Read the manual page on shutdown to find out more about this. Running from a read-only file system (CDROM?): -o All communication to init goes through the FIFO /run/initctl. +* All communication to init goes through the FIFO /run/initctl. There should be no problem using a read-only root file system IF you use a Linux kernel > 1.3.66. Older kernels don't allow writing to a FIFO on a read-only file system. - -Miquel van Smoorenburg + diff --git a/doc/Propaganda b/doc/Propaganda index 072aa13..5efa7c0 100644 --- a/doc/Propaganda +++ b/doc/Propaganda @@ -1,19 +1,19 @@ - Propaganda for version 2.58 of sysvinit & utilities + Propaganda for version 2.89 of sysvinit & utilities ================================================== -NOTE: If you use a standard distribution like Slackware, Debian -or Redhat there probably is no need to upgrade. Installing sysvinit +NOTE: If you use a standard distribution like Slackware, Devuan +or Gentoo there probably is no need to upgrade. Installing sysvinit is only for those that upgrade their system by hand or for people that create Linux distributions. -Sysvinit is probably the most widely used init package for Linux. -Most distributions use it. sysvinit 2.4 is really a good package, -and it was not the need for bugfixes but the need for more features +SysV init was probably the most widely used init package for Linux. +Most distributions once used it. sysvinit 2.4 was really a good package, +and it was not the need for bug fixes but the need for more features that made me work on sysvinit again. -Sysvinit is now a debian package. Debian source packages are not +SysV init is now a Debian package. Debian source packages are not special in any way -- in fact you can just unpack and compile it on any other Linux distribution. @@ -61,7 +61,7 @@ as in the 2.4 release: The sysvinit package includes -* a sysv compatible /sbin/init program +* a SysV compatible /sbin/init program * a telinit program (er, just a link to /sbin/init) to change runlevels * a featureful shutdown * halt and reboot to assist shutdown @@ -69,13 +69,7 @@ The sysvinit package includes * the wall & mesg programs (not installed by default) * manpages for everything -The new sysv init can be found on: +The new SysV init can be found on: -tsx-11.mit.edu:/pub/linux/sources/sbin as sysvinit-2.58-1.tar.gz -sunsite.unc.edu:/pub/Linux/system/Daemons as sysvinit-2.58-1.tar.gz - -It will be moved there in a few days, in the mean time it is -probably in the Incoming directory. - -Mike. (02-Jan-1996) +http://download.savannah.nongnu.org/releases/sysvinit/ diff --git a/doc/sysvinit-2.86.lsm b/doc/sysvinit-2.86.lsm index 3b985a5..25f67e7 100644 --- a/doc/sysvinit-2.86.lsm +++ b/doc/sysvinit-2.86.lsm @@ -1,14 +1,12 @@ Begin3 Title: sysvinit and utilities -Version: 2.86 -Entered-Date: 30JUL2004 +Version: 2.89 +Entered-Date: 24FEB2018 Description: This is the Linux System V init. This version can be compiled with glibc 2.0.6 and up. Author: miquels@cistron.nl (Miquel van Smoorenburg) -Primary-Site: ftp.cistron.nl /pub/people/miquels/software - 92K sysvinit-2.86.tar.gz -Alternate-Site: sunsite.unc.edu /pub/Linux/system/daemons/init - 92K sysvinit-2.86.tar.gz +Primary-Site: http://download.savannah.nongnu.org /releases/sysvinit/ + 103K sysvinit-2.89.tar.bz2 Copying-Policy: GPL Keywords: init shutdown halt reboot End From a8ef2a24c5ba561515d6c6275bac6e4943115dcf Mon Sep 17 00:00:00 2001 From: Jesse Smith Date: Wed, 7 Mar 2018 13:59:51 -0400 Subject: [PATCH 4/4] Updated changelog. --- doc/Changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/Changelog b/doc/Changelog index a6b73c6..aa67744 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -46,7 +46,7 @@ sysvinit (2.89) UNRELEASED; urgency=low We will use /etc/nologin and let distros patch to suit their own preference. * Updated halt.8 man page with corrections from Christoph Anton Mitterer. - * Confirme we have applied patch from Bjarni Ingi Gislason + * Confirmed we have applied patch from Bjarni Ingi Gislason which fixes typo in fstab-decode man page. * Applied Debian patch to allow init to build on GNU Hurd. (Credit: Roger Leigh) @@ -72,7 +72,7 @@ sysvinit (2.89) UNRELEASED; urgency=low effort and pull in a new dependency on libmount. * Problem with pidof breaks after prelink (Savannah bug #34992) fixed. Patch supplied by Dave Dykstra. - * Patch to automatically spawn agetty on kernel consoles + * Patch to automatically spawn a getty on kernel consoles The feature is useful for developers and admins that occasionally need to boot with e.g. console=ttyS0. The built in default can be overridden via inittab for each device. An