Generate man pages with m4.
authorDavin McCall <davmac@davmac.org>
Sun, 14 Jul 2019 01:53:39 +0000 (02:53 +0100)
committerDavin McCall <davmac@davmac.org>
Sun, 14 Jul 2019 01:53:39 +0000 (02:53 +0100)
Allows substituting current version and release date.

Makefile
doc/manpages/Makefile
doc/manpages/dinit-service.5 [deleted file]
doc/manpages/dinit-service.5.m4 [new file with mode: 0644]
doc/manpages/dinit.8 [deleted file]
doc/manpages/dinit.8.m4 [new file with mode: 0644]
doc/manpages/dinitctl.8 [deleted file]
doc/manpages/dinitctl.8.m4 [new file with mode: 0644]
doc/manpages/shutdown.8 [deleted file]
doc/manpages/shutdown.8.m4 [new file with mode: 0644]
src/version.conf [new file with mode: 0644]

index faa146c6d1666f11a7318e8be0b0381b8ea55cb2..9cd695d75ac857d155f48b295a278ad9f500a917 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -2,6 +2,7 @@
 
 all:
        $(MAKE) -C src all
+       $(MAKE) -C doc/manpages all
        @echo "***"
        @echo "*** Build complete; use \"make check\" to run unit tests, \"make check-igr\" for"
        @echo "*** integration tests, or \"make install\" to install."
@@ -22,3 +23,4 @@ install:
 
 clean:
        $(MAKE) -C src clean
+       $(MAKE) -C doc/manpages clean
index 4a37177f14b9c6ef236623e44a7b847224f74398..c343a8fdf6d6d839d32edb92a82d2cf34511d049 100644 (file)
@@ -1,6 +1,11 @@
 include ../../mconfig
+include ../../src/version.conf
 
-install:
+all: generate
+
+generate: dinit.8 dinitctl.8 dinit-service.5 shutdown.8
+
+install: generate
        mkdir -p "$(DESTDIR)$(MANDIR)/man8"
        install -m644 dinit.8 dinitctl.8 "$(DESTDIR)$(MANDIR)/man8"
        mkdir -p "$(DESTDIR)$(MANDIR)/man5"
@@ -10,3 +15,18 @@ ifeq ($(BUILD_SHUTDOWN),yes)
        ln -f "$(DESTDIR)$(MANDIR)/man8/shutdown.8" "$(DESTDIR)$(MANDIR)/man8/halt.8" 
        ln -f "$(DESTDIR)$(MANDIR)/man8/shutdown.8" "$(DESTDIR)$(MANDIR)/man8/reboot.8" 
 endif
+
+clean:
+       rm -f dinit.8 dinitctl.8 dinit-service.5 shutdown.8
+
+dinit.8: dinit.8.m4
+       m4 -DVERSION=$(VERSION) -DMONTH=$(MONTH) -DYEAR=$(YEAR) dinit.8.m4 > dinit.8
+
+dinitctl.8: dinitctl.8.m4
+       m4 -DVERSION=$(VERSION) -DMONTH=$(MONTH) -DYEAR=$(YEAR) dinitctl.8.m4 > dinitctl.8
+
+dinit-service.5: dinit-service.5.m4
+       m4 -DVERSION=$(VERSION) -DMONTH=$(MONTH) -DYEAR=$(YEAR) dinit-service.5.m4 > dinit-service.5
+
+shutdown.8: shutdown.8.m4
+       m4 -DVERSION=$(VERSION) -DMONTH=$(MONTH) -DYEAR=$(YEAR) shutdown.8.m4 > shutdown.8
diff --git a/doc/manpages/dinit-service.5 b/doc/manpages/dinit-service.5
deleted file mode 100644 (file)
index 7346636..0000000
+++ /dev/null
@@ -1,454 +0,0 @@
-.TH DINIT-SERVICE "5" "June 2019" "Dinit 0.5.2" "Dinit \- service management system"
-.SH NAME
-Dinit service description files
-.\"
-.SH SYNOPSIS
-.\"
-.ft CR
-/etc/dinit.d/\fIservice-name\fR, $HOME/dinit.d/\fIservice-name\fR
-.ft
-.\"
-.SH DESCRIPTION
-.\"
-The service description files for \fBDinit\fR each describe a service. The name
-of the file corresponds to the name of the service it describes. 
-.LP
-Service description files specify the various attributes of a service. A
-service description file is named after the service it represents, and is
-a plain-text file with simple key-value format. The description files are
-located in a service description directory; by default, the system process
-searches \fI/etc/dinit.d\fR, \fI/usr/local/lib/dinit.d\fR and
-\fI/lib/dinit.d\fR, while a user process searches \fI$HOME/dinit.d\fR.
-.LP
-All services have a \fItype\fR and a set of \fIdependencies\fR. Service
-types are discussed in the following subsection. If a service depends on
-another service, then starting the first service causes the second to start
-also (and the second service must complete its startup before the first
-is considered started). Similarly, if one service depends on another which
-becomes stopped, the first service must also stop.
-.\"
-.SS SERVICE TYPES
-.\"
-There are four basic types of service:
-.IP \(bu
-\fBProcess\fR services. This kind of service runs as a single process; starting
-the service simply requires starting the process; stopping the service is
-accomplished by stopping the process (via sending it a signal).
-.IP \(bu
-\fBBgprocess\fR services ("background process" services). This kind of
-service is similar to a regular process service, but the process daemonizes
-or otherwise forks from the original process which starts it, and the
-process ID is written to a file. Dinit can read the process ID from the
-file and, if it is running as the system init process, can supervise it.
-.IP \(bu
-\fBScripted\fR services are services which are started and stopped by a
-command (which need not actually be a script, despite the name). They can
-not be supervised.
-.IP \(bu
-\fBInternal\fR services do not run as an external process at all. They can
-be started and stopped without any external action. They are useful for
-grouping other services (via service dependencies).
-.\"
-.SS SERVICE PROPERTIES
-.\"
-This section described the various service properties that can be specified
-in a service description file. Each line of the file can specify a single
-property value, expressed as "\fIproperty-name\fR = \fIvalue\fR". Comments
-begin with a hash mark (#) and extend to the end of the line (they must be
-separated from setting values by at least one whitespace character). Values
-are interpreted literally, except that:
-.\"
-.IP \(bu
-White space (comprised of spaces, tabs, etc) is collapsed to a single space.
-.IP \(bu
-Double quotes (") can be used around all or part of a property value, to
-prevent whitespace collapse and prevent interpretation of other special
-characters (such as "#") inside the quotes. The quote characters are not
-considered part of the parameter value.
-.IP \(bu
-A backslash (\\) can be used to escape the next character, causing it to
-lose any special meaning and become part of the property value. A double
-backslash (\\\\) is collapsed to a single backslash within the parameter
-value.
-.LP
-The following properties can be specified:
-.TP
-\fBtype\fR = {process | bgprocess | scripted | internal}
-Specifies the service type.
-.TP
-\fBcommand\fR = \fIcommand-string\fR
-Specifies the command, including command-line arguments, for starting the
-process. Applies only to \fBprocess\fR, \fBbgprocess\fR and \fBscripted\fR
-services.
-.TP
-\fBstop\-command\fR = \fIcommand-string\fR
-Specifies the command to stop the service. Applicable only to \fBscripted\fR
-services.
-.TP
-\fBworking-dir\fR = \fIdirectory\fR
-Specifies the working directory for this service. For a scripted service, this
-affects both the start command and the stop command.
-.TP
-\fBrun\-as\fR = \fIuser-id\fR
-Specifies which user to run the process(es) for this service as. The group id
-for the process will also be set to the primary group of the specified user.
-.TP
-\fBrestart\fR = {yes | true | no | false}
-Indicates whether the service should automatically restart if it stops for
-any reason (including unexpected process termination, service dependency
-stopping, or user-initiated service stop).
-.TP
-\fBsmooth\-recovery\fR = {yes | true | no | false}
-Applies only to \fBprocess\fR and \fBbgprocess\fR services. When set true/yes,
-an automatic process restart can be performed without first stopping any
-dependent services. This setting is meaningless if the \fBrestart\fR setting
-is set to false.
-.TP
-\fBrestart\-delay\fR = \fIXXX.YYYY\fR
-Specifies the minimum time between automatic restarts. Enforcing a sensible
-minimum prevents Dinit from consuming a large number of process cycles in
-case a process continuously fails immediately after it is started. The
-default is 0.2 (200 milliseconds).
-.TP
-\fBrestart\-limit\-interval\fR = \fIXXX.YYYY\fR
-Sets the interval, in seconds, over which restarts are limited. If a process
-automatically restarts more than a certain number of times (specified by the
-\fBrestart-limit-count\fR setting) in this time interval, it will not restart
-again. The default value is 10 seconds.
-.TP
-\fBrestart\-limit\-count\fR = \fINNN\fR
-Specifies the maximum number of times that a service can automatically restart
-over the interval specified by \fBrestart\-limit\-interval\fR. Specify a value
-of 0 to disable the restart limit.
-.TP
-\fBstart\-timeout\fR = \fIXXX.YYY\fR
-Specifies the time in seconds allowed for the service to start. If the
-service takes longer than this, its process group is sent a SIGINT signal
-and enters the "stopping" state (this may be subject to a stop timeout, as
-specified via \fBstop\-timeout\fR, after which the process group will be
-terminated via SIGKILL). The timeout period begins only when all dependencies
-have been stopped. The default timeout is 60 seconds. Specify a value of 0 to
-allow unlimited start time.
-.TP
-\fBstop\-timeout\fR = \fIXXX.YYY\fR
-Specifies the time in seconds allowed for the service to stop. If the
-service takes longer than this, its process group is sent a SIGKILL signal
-which should cause it to terminate immediately. The timeout period begins
-only when all dependent services have already stopped. The default
-timeout is 10 seconds. Specify a value of 0 to allow unlimited stop time.
-.TP
-\fBpid\-file\fR = \fIpath-to-file\fR
-For \fBbgprocess\fR type services only; specifies the path of the file where
-daemon will write its process ID before detaching. Dinit will read the
-contents of this file when starting the service, once the initial process
-exits, will supervise the process with the discovered process ID, and may
-send signals to the process ID to stop the service; if Dinit runs as a
-privileged user the path should therefore not be writable by unprivileged
-users.
-.TP
-\fBdepends\-on\fR = \fIservice-name\fR
-This service depends on the named service. Starting this service will start
-the named service; the command to start this service will not be executed
-until the named service has started. If the named service is stopped then
-this service will also be stopped.
-.TP
-\fBdepends\-ms\fR = \fIservice-name\fR
-This service has a "milestone" dependency on the named service. Starting this
-service will start the named service; this service will not start until the
-named service has started, and will fail to start if the named service does
-not start. Once the named service reaches the started state, however, the
-dependency is effectively dropped until this service is next started.
-.TP
-\fBwaits\-for\fR = \fIservice-name\fR
-When this service is started, wait for the named service to finish starting
-(or to fail starting) before commencing the start procedure for this service.
-Starting this service will automatically start the named service. If the
-named service fails to start, this service will start as usual (subject to
-other dependencies being met).
-.TP
-\fBwaits\-for.d\fR = \fIdirectory-path\fR
-For each file name in \fIdirectory-path\fR which does not begin with a dot,
-add a \fBwaits-for\fR dependency to the service with the same name. Note that
-contents of files in the specified directory are not significant; expected
-usage is to have symbolic links to the associated service description files,
-but this is not required. Failure to read the directory contents, or to find
-any of the services named within, is not considered fatal.
-
-The directory path, if not absolute, is relative to the directory containing
-the service description file.
-.TP
-\fBchain-to\fR = \fIservice-name\fR
-When this service completes successfully (i.e. starts and then stops), the
-named service should be started. Note that the named service is not loaded
-until that time; naming an invalid service will not cause this service to
-fail to load.
-
-This can be used for a service that supplies an interactive "recovery mode"
-for another service; once the user exits the recovery shell, the primary
-service (as named via this setting) will then start. It also supports
-multi-stage system startup where later service description files reside on
-a separate filesystem that is mounted during the first stage; such service
-descriptions will not be found at initial start, and so cannot be started
-directly, but can be chained via this directive.
-.TP
-\fBsocket\-listen\fR = \fIsocket-path\fR
-Pre-open a socket for the service and pass it to the service using the
-\fBsystemd\fR activation protocol. This by itself does not give so called
-"socket activation", but does allow that any process trying to connect to the
-specified socket will be able to do so, even before the service is properly
-prepared to accept connections.
-.TP
-\fBsocket\-permissions\fR = \fIoctal-permissions-mask\fR
-Gives the permissions for the socket specified using \fBsocket-listen\fR.
-Normally this will be 600 (user access only), 660 (user and group
-access), or 666 (all users). The default is 666.
-.TP
-\fBsocket\-uid\fR = {\fInumeric-user-id\fR | \fIusername\fR}
-Specifies the user that should own the activation socket. If
-\fBsocket\-uid\fR is specified without also specifying \fBsocket-gid\fR, then
-the socket group is the primary group of the specified user (as found in the
-system user database, normally \fI/etc/passwd\fR). If the socket owner is not
-specified, the socket will be owned by the user id of the Dinit process.
-.TP
-\fBsocket\-gid\fR = {\fInumeric-group-id\fR | \fIgroup-name\fR}
-Specifies the group of the activation socket. See discussion of
-\fBsocket\-uid\fR.
-.TP
-\fBterm\-signal\fR = {HUP | INT | QUIT | USR1 | USR2 | KILL}
-Specifies an additional signal to send to the process when requesting it
-to terminate (applies to 'process' services only). SIGTERM is always
-sent along with the specified signal, unless the \fBno\-sigterm\fR option is
-specified via the \fBoptions\fR parameter.
-.TP
-\fBready\-notification\fR = {\fBpipefd:\fR\fIfd-number\fR | \fBpipevar:\fR\fIenv-var-name\fR}
-Specifies the mechanism, if any, by which a process service will notify that it is ready
-(successfully started). If not specified, a process service is considered started as soon as it
-has begun execution. The two options are:
-.RS
-.IP \(bu
-\fBpipefd:\fR\fIfd-number\fR \(em the service will write a message to the specified file descriptor,
-which \fBdinit\fR sets up as the write end of a pipe before execution. This mechanism is compatible
-with the S6 supervision suite.
-.IP \(bu
-\fBpipevar:\fR\fIenv-var-name\fR \(em the service will write a message to file descriptor identified
-using the contents of the specified environment variable, which will be set by \fBdinit\fR before
-execution to a file descriptor (chosen arbitrarily) attached to the write end of a pipe.
-.RE
-.TP
-\fBlogfile\fR = \fIlog-file-path\fR
-Specifies the log file for the service. Output from the service process
-will go this file.
-.TP
-\fBoptions\fR = \fIoption\fR...
-Specifies various options for this service. See the \fBOPTIONS\fR section. This
-directive can be specified multiple times to set additional options.
-.TP
-\fBload-options\fR = \fIload_option\fR...
-Specifies options for interpreting other settings when loading this service
-description. Currently there is only one available option, \fBsub-vars\fR,
-which specifies that command line arguments in the form of \fB$NAME\fR should
-be replaced with the contents of the environment variable with the specified
-name. Note that no word-splitting is performed and the variable value always
-becomes a single argument; if the variable is not defined, it is replaced with
-an empty (zero-length) argument.
-.TP
-\fBinittab-id\fR = \fIid-string\fR
-When this service is started, if this setting (or the \fBinittab-line\fR setting) has a
-specified value, an entry will be created in the system "utmp" database which tracks
-processes and logged-in users. Typically this database is used by the "who" command to
-list logged-in users. The entry will be cleared when the service terminates.
-
-The \fBinittab-id\fR setting specifies the "inittab id" to be written in the entry for
-the process. The value is normally quite meaningless. However, it should be distinct
-(or unset) for separate processes. It is typically limited to a very short length.
-
-The "utmp" database is mostly a historical artifact. Access to it on some systems is
-prone to denial-of-service by unprivileged users. It is therefore recommended that this
-setting not be used. However, "who" and similar utilities may not work correctly without
-this setting (or \fBinittab-line\fR) enabled appropriately.
-
-This setting has no effect if Dinit was not built with support for writing to the "utmp"
-database.
-.TP
-\fBinittab-line\fR = \fItty-name-string\fR
-This specifies the tty line that will be written to the "utmp" database when this service
-is started. Normally, for a terminal login service, it would match the terminal device name
-on which the login process runs, without the "/dev/" prefix.
-
-See the description of the \fBinittab-id\fR setting for details.
-.TP
-\fBrlimit-nofile\fR = \fIresource-limits\fR
-Specifies the number of file descriptors that a process may have open simultaneously. See the
-\fBRESOURCE LIMITS\fR section.
-.TP
-\fBrlimit-core\fR = \fIresource-limits\fR
-Specifies the maximum size of the core dump file that will be generated for the process if it
-crashes (in a way that would result in a core dump). See the \fBRESOURCE LIMITS\fR section.
-.TP
-\fBrlimit-data\fR = \fIresource-limits\fR
-Specifies the maximum size of the data segment for the process, including statically allocated
-data and heap allocations. Precise meaning may vary between operating systems. See the
-\fBRESOURCE LIMITS\fR section.
-.TP
-\fBrlimit-addrspace\fR = \fIresource-limits\fR
-Specifies the maximum size of the address space of the process. See the \fBRESOURCE LIMITS\fR
-section. Note that some operating systems (notably OpenBSD) do not support this limit; the
-setting will be ignored on such systems.
-.\"
-.SS OPTIONS
-.\"
-These options are specified via the \fBoptions\fR parameter. 
-.\"
-.TP
-\fBno\-sigterm\fR
-Specifies that the TERM signal should not be send to the process to terminate
-it. (Another signal can be specified using the \fBtermsignal\fR setting; if no
-other signal is specified, no signal will be sent, which usually means that
-the service will not terminate).
-.TP
-\fBruns\-on\-console\fR
-Specifies that this service uses the console; its input and output should be
-directed to the console (or precisely, to the device to which Dinit's standard
-output stream is connected). A service running on the console prevents other
-services from running on the console (they will queue for the console).
-
-The \fIinterrupt\fR key (normally control-C) will be active for process / scripted
-services that run on the console. Handling of an interrupt is determined by
-the service process, but typically will cause it to terminate.
-.TP
-\fBstarts\-on\-console\fR
-Specifies that this service uses the console during service startup. This is
-implied by \fBruns-on-console\fR, but can be specified separately for services
-that need the console while they start but not afterwards.
-
-This setting is not applicable to regular \fBprocess\fR services, but can be
-used for \fBscripted\fR and \fBbgprocess\fR services. It allows for
-interrupting startup via the \fIinterrupt\fR key (normally control-C). This is
-useful to allow filesystem checks to be interrupted/skipped.
-
-This option is implied by \fBruns\-on\-console\fR, and is mutually exclusive
-with \fBshares\-console\fR; setting this option, or setting \fBruns\-on\-console\fR,
-unsets \fBshares\-console\fR.
-.TP
-\fBshares\-console\fR
-Specifies that this service should be given access to the console (input and output
-will be connected to the console), but that it should not exclusively hold the
-console and not delay the start of services with \fBstarts\-on\-console\fR.
-
-This is mutually exclusive with both \fBstarts\-on\-console\fR and \fBruns\-on\-console\fR;
-setting this option unsets both those options.
-.TP
-\fBstarts-rwfs\fR
-This service mounts the root filesystem read/write (or at least mounts the
-normal writable filesystems for the system). This prompts Dinit to create its
-control socket, if it has not already managed to do so.
-.TP
-\fBstarts-log\fR
-This service starts the system log daemon. Dinit will begin logging via the
-\fI/dev/log\fR socket.
-.TP
-\fBpass-cs-fd\fR
-Pass an open Dinit control socket to the process when launching it (the
-\fIDINIT_CS_FD\fR environment variable will be set to the file descriptor of
-the socket). This allows the service to issue commands to Dinit even if the
-regular control socket is not available yet.
-
-Using this option has security implications! The service which receives the
-control socket must close it before launching any untrusted processes. You
-should not use this option unless the service is designed to receive a Dinit
-control socket.
-.TP
-\fBstart-interruptible\fR
-This service can have its startup interrupted (cancelled) if it becomes inactive
-while still starting, by sending it the SIGINT signal. This is meaningful only
-for \fBbgprocess\fR and \fBscripted\fR services.
-.TP
-\fBskippable\fR
-For scripted services, indicates that if the service startup process terminates
-via an interrupt signal (SIGINT), then the service should be considered started.
-Note that if the interrupt was issued by Dinit to cancel startup, the service
-will instead be considered stopped.
-.TP
-\fBsignal-process-only\fR
-Signal the service process only, rather than its entire process group, whenever
-sending it a signal for any reason.
-.RE
-.LP
-The next section contains example service descriptions including some of the
-parameters and options described above.
-.\"
-.SS RESOURCE LIMITS
-.\"
-There are several settings for specifying process resource limits: \fBrlmit-nofile\fR,
-\fBrlimit-core\fR, \fBrlimit-data\fR and \fBrlimit-addrspace\fR. See the descriptions
-of each above. These settings place a limit on resource usage directly by the process.
-Note that resource limits are inherited by subprocesses, but that usage of a resource
-and subprocess are counted separately (in other words, a process can effectively bypass
-its resource limits by spawning a subprocess and allocating further resources within it).
-
-Resources have both a \fIhard\fR and \fIsoft\fR limit. The soft limit is the effective
-limit, but note that a process can raise its soft limit up to the hard limit for any
-given resource. Therefore the soft limit acts more as a sanity-check; a process can
-exceed the soft limit only by deliberately raising it first.
-
-Resource limits are specified in the following format:
-
-.RS
-\fIsoft-limit\fR:\fIhard-limit\fR
-.RE
-
-Either the soft limit or the hard limit can be omitted (in which case it will be unchanged).
-A limit can be specified as a dash, `\fB-\fR', in which case the limit will be removed. If
-only one value is specified with no colon separator, it affects both the soft and hard limit.
-.\"
-.SS EXAMPLES
-.LP
-Here is an example service description for the \fBmysql\fR database server.
-It has a dependency on the \fBrcboot\fR service (not shown) which is
-expected to have set up the system to a level suitable for basic operation.
-
-.RS
-.nf
-.gcolor blue
-.ft CR
-# mysqld service
-type = process
-command = /usr/bin/mysqld --user=mysql
-logfile = /var/log/mysqld.log
-smooth-recovery = true
-restart = false
-depends-on = rcboot # Basic system services must be ready
-.ft
-.gcolor
-.RE
-.fi
-.LP
-Here is an examples for a filesystem check "service", run by a script
-(\fI/etc/dinit.d/rootfscheck.sh\fR). The script may need to reboot the
-system, but the control socket may not have been created, so it uses the
-\fBpass-cs-fd\fR option to allow the \fBreboot\fR command to issue control
-commands to Dinit. It runs on the console, so that output is visible and
-the process can be interrupted using control-C, in which case the check is
-skipped but dependent services continue to start.
-
-.RS
-.nf
-.gcolor blue
-.ft CR
-# rootfscheck service
-type = scripted
-command = /etc/dinit.d/rootfscheck.sh
-restart = false
-options = starts-on-console pass-cs-fd
-options = start-interruptible skippable
-depends-on = early-filesystems  # /proc and /dev
-depends-on = device-node-daemon
-.ft
-.gcolor
-.fi
-.RE
-
-More examples are provided with the Dinit distribution.
-.\"
-.SH AUTHOR
-Dinit, and this manual, were written by Davin McCall.
diff --git a/doc/manpages/dinit-service.5.m4 b/doc/manpages/dinit-service.5.m4
new file mode 100644 (file)
index 0000000..5d0ca8d
--- /dev/null
@@ -0,0 +1,456 @@
+changequote(`@@@',`$$$')dnl
+@@@.TH DINIT-SERVICE "5" "$$$MONTH YEAR@@@" "Dinit $$$VERSION@@@" "Dinit \- service management system"
+.SH NAME
+Dinit service description files
+.\"
+.SH SYNOPSIS
+.\"
+.ft CR
+/etc/dinit.d/\fIservice-name\fR, $HOME/dinit.d/\fIservice-name\fR
+.ft
+.\"
+.SH DESCRIPTION
+.\"
+The service description files for \fBDinit\fR each describe a service. The name
+of the file corresponds to the name of the service it describes. 
+.LP
+Service description files specify the various attributes of a service. A
+service description file is named after the service it represents, and is
+a plain-text file with simple key-value format. The description files are
+located in a service description directory; by default, the system process
+searches \fI/etc/dinit.d\fR, \fI/usr/local/lib/dinit.d\fR and
+\fI/lib/dinit.d\fR, while a user process searches \fI$HOME/dinit.d\fR.
+.LP
+All services have a \fItype\fR and a set of \fIdependencies\fR. Service
+types are discussed in the following subsection. If a service depends on
+another service, then starting the first service causes the second to start
+also (and the second service must complete its startup before the first
+is considered started). Similarly, if one service depends on another which
+becomes stopped, the first service must also stop.
+.\"
+.SS SERVICE TYPES
+.\"
+There are four basic types of service:
+.IP \(bu
+\fBProcess\fR services. This kind of service runs as a single process; starting
+the service simply requires starting the process; stopping the service is
+accomplished by stopping the process (via sending it a signal).
+.IP \(bu
+\fBBgprocess\fR services ("background process" services). This kind of
+service is similar to a regular process service, but the process daemonizes
+or otherwise forks from the original process which starts it, and the
+process ID is written to a file. Dinit can read the process ID from the
+file and, if it is running as the system init process, can supervise it.
+.IP \(bu
+\fBScripted\fR services are services which are started and stopped by a
+command (which need not actually be a script, despite the name). They can
+not be supervised.
+.IP \(bu
+\fBInternal\fR services do not run as an external process at all. They can
+be started and stopped without any external action. They are useful for
+grouping other services (via service dependencies).
+.\"
+.SS SERVICE PROPERTIES
+.\"
+This section described the various service properties that can be specified
+in a service description file. Each line of the file can specify a single
+property value, expressed as "\fIproperty-name\fR = \fIvalue\fR". Comments
+begin with a hash mark (#) and extend to the end of the line (they must be
+separated from setting values by at least one whitespace character). Values
+are interpreted literally, except that:
+.\"
+.IP \(bu
+White space (comprised of spaces, tabs, etc) is collapsed to a single space.
+.IP \(bu
+Double quotes (") can be used around all or part of a property value, to
+prevent whitespace collapse and prevent interpretation of other special
+characters (such as "#") inside the quotes. The quote characters are not
+considered part of the parameter value.
+.IP \(bu
+A backslash (\\) can be used to escape the next character, causing it to
+lose any special meaning and become part of the property value. A double
+backslash (\\\\) is collapsed to a single backslash within the parameter
+value.
+.LP
+The following properties can be specified:
+.TP
+\fBtype\fR = {process | bgprocess | scripted | internal}
+Specifies the service type.
+.TP
+\fBcommand\fR = \fIcommand-string\fR
+Specifies the command, including command-line arguments, for starting the
+process. Applies only to \fBprocess\fR, \fBbgprocess\fR and \fBscripted\fR
+services.
+.TP
+\fBstop\-command\fR = \fIcommand-string\fR
+Specifies the command to stop the service. Applicable only to \fBscripted\fR
+services.
+.TP
+\fBworking-dir\fR = \fIdirectory\fR
+Specifies the working directory for this service. For a scripted service, this
+affects both the start command and the stop command.
+.TP
+\fBrun\-as\fR = \fIuser-id\fR
+Specifies which user to run the process(es) for this service as. The group id
+for the process will also be set to the primary group of the specified user.
+.TP
+\fBrestart\fR = {yes | true | no | false}
+Indicates whether the service should automatically restart if it stops for
+any reason (including unexpected process termination, service dependency
+stopping, or user-initiated service stop).
+.TP
+\fBsmooth\-recovery\fR = {yes | true | no | false}
+Applies only to \fBprocess\fR and \fBbgprocess\fR services. When set true/yes,
+an automatic process restart can be performed without first stopping any
+dependent services. This setting is meaningless if the \fBrestart\fR setting
+is set to false.
+.TP
+\fBrestart\-delay\fR = \fIXXX.YYYY\fR
+Specifies the minimum time between automatic restarts. Enforcing a sensible
+minimum prevents Dinit from consuming a large number of process cycles in
+case a process continuously fails immediately after it is started. The
+default is 0.2 (200 milliseconds).
+.TP
+\fBrestart\-limit\-interval\fR = \fIXXX.YYYY\fR
+Sets the interval, in seconds, over which restarts are limited. If a process
+automatically restarts more than a certain number of times (specified by the
+\fBrestart-limit-count\fR setting) in this time interval, it will not restart
+again. The default value is 10 seconds.
+.TP
+\fBrestart\-limit\-count\fR = \fINNN\fR
+Specifies the maximum number of times that a service can automatically restart
+over the interval specified by \fBrestart\-limit\-interval\fR. Specify a value
+of 0 to disable the restart limit.
+.TP
+\fBstart\-timeout\fR = \fIXXX.YYY\fR
+Specifies the time in seconds allowed for the service to start. If the
+service takes longer than this, its process group is sent a SIGINT signal
+and enters the "stopping" state (this may be subject to a stop timeout, as
+specified via \fBstop\-timeout\fR, after which the process group will be
+terminated via SIGKILL). The timeout period begins only when all dependencies
+have been stopped. The default timeout is 60 seconds. Specify a value of 0 to
+allow unlimited start time.
+.TP
+\fBstop\-timeout\fR = \fIXXX.YYY\fR
+Specifies the time in seconds allowed for the service to stop. If the
+service takes longer than this, its process group is sent a SIGKILL signal
+which should cause it to terminate immediately. The timeout period begins
+only when all dependent services have already stopped. The default
+timeout is 10 seconds. Specify a value of 0 to allow unlimited stop time.
+.TP
+\fBpid\-file\fR = \fIpath-to-file\fR
+For \fBbgprocess\fR type services only; specifies the path of the file where
+daemon will write its process ID before detaching. Dinit will read the
+contents of this file when starting the service, once the initial process
+exits, will supervise the process with the discovered process ID, and may
+send signals to the process ID to stop the service; if Dinit runs as a
+privileged user the path should therefore not be writable by unprivileged
+users.
+.TP
+\fBdepends\-on\fR = \fIservice-name\fR
+This service depends on the named service. Starting this service will start
+the named service; the command to start this service will not be executed
+until the named service has started. If the named service is stopped then
+this service will also be stopped.
+.TP
+\fBdepends\-ms\fR = \fIservice-name\fR
+This service has a "milestone" dependency on the named service. Starting this
+service will start the named service; this service will not start until the
+named service has started, and will fail to start if the named service does
+not start. Once the named service reaches the started state, however, the
+dependency is effectively dropped until this service is next started.
+.TP
+\fBwaits\-for\fR = \fIservice-name\fR
+When this service is started, wait for the named service to finish starting
+(or to fail starting) before commencing the start procedure for this service.
+Starting this service will automatically start the named service. If the
+named service fails to start, this service will start as usual (subject to
+other dependencies being met).
+.TP
+\fBwaits\-for.d\fR = \fIdirectory-path\fR
+For each file name in \fIdirectory-path\fR which does not begin with a dot,
+add a \fBwaits-for\fR dependency to the service with the same name. Note that
+contents of files in the specified directory are not significant; expected
+usage is to have symbolic links to the associated service description files,
+but this is not required. Failure to read the directory contents, or to find
+any of the services named within, is not considered fatal.
+
+The directory path, if not absolute, is relative to the directory containing
+the service description file.
+.TP
+\fBchain-to\fR = \fIservice-name\fR
+When this service completes successfully (i.e. starts and then stops), the
+named service should be started. Note that the named service is not loaded
+until that time; naming an invalid service will not cause this service to
+fail to load.
+
+This can be used for a service that supplies an interactive "recovery mode"
+for another service; once the user exits the recovery shell, the primary
+service (as named via this setting) will then start. It also supports
+multi-stage system startup where later service description files reside on
+a separate filesystem that is mounted during the first stage; such service
+descriptions will not be found at initial start, and so cannot be started
+directly, but can be chained via this directive.
+.TP
+\fBsocket\-listen\fR = \fIsocket-path\fR
+Pre-open a socket for the service and pass it to the service using the
+\fBsystemd\fR activation protocol. This by itself does not give so called
+"socket activation", but does allow that any process trying to connect to the
+specified socket will be able to do so, even before the service is properly
+prepared to accept connections.
+.TP
+\fBsocket\-permissions\fR = \fIoctal-permissions-mask\fR
+Gives the permissions for the socket specified using \fBsocket-listen\fR.
+Normally this will be 600 (user access only), 660 (user and group
+access), or 666 (all users). The default is 666.
+.TP
+\fBsocket\-uid\fR = {\fInumeric-user-id\fR | \fIusername\fR}
+Specifies the user that should own the activation socket. If
+\fBsocket\-uid\fR is specified without also specifying \fBsocket-gid\fR, then
+the socket group is the primary group of the specified user (as found in the
+system user database, normally \fI/etc/passwd\fR). If the socket owner is not
+specified, the socket will be owned by the user id of the Dinit process.
+.TP
+\fBsocket\-gid\fR = {\fInumeric-group-id\fR | \fIgroup-name\fR}
+Specifies the group of the activation socket. See discussion of
+\fBsocket\-uid\fR.
+.TP
+\fBterm\-signal\fR = {HUP | INT | QUIT | USR1 | USR2 | KILL}
+Specifies an additional signal to send to the process when requesting it
+to terminate (applies to 'process' services only). SIGTERM is always
+sent along with the specified signal, unless the \fBno\-sigterm\fR option is
+specified via the \fBoptions\fR parameter.
+.TP
+\fBready\-notification\fR = {\fBpipefd:\fR\fIfd-number\fR | \fBpipevar:\fR\fIenv-var-name\fR}
+Specifies the mechanism, if any, by which a process service will notify that it is ready
+(successfully started). If not specified, a process service is considered started as soon as it
+has begun execution. The two options are:
+.RS
+.IP \(bu
+\fBpipefd:\fR\fIfd-number\fR \(em the service will write a message to the specified file descriptor,
+which \fBdinit\fR sets up as the write end of a pipe before execution. This mechanism is compatible
+with the S6 supervision suite.
+.IP \(bu
+\fBpipevar:\fR\fIenv-var-name\fR \(em the service will write a message to file descriptor identified
+using the contents of the specified environment variable, which will be set by \fBdinit\fR before
+execution to a file descriptor (chosen arbitrarily) attached to the write end of a pipe.
+.RE
+.TP
+\fBlogfile\fR = \fIlog-file-path\fR
+Specifies the log file for the service. Output from the service process
+will go this file.
+.TP
+\fBoptions\fR = \fIoption\fR...
+Specifies various options for this service. See the \fBOPTIONS\fR section. This
+directive can be specified multiple times to set additional options.
+.TP
+\fBload-options\fR = \fIload_option\fR...
+Specifies options for interpreting other settings when loading this service
+description. Currently there is only one available option, \fBsub-vars\fR,
+which specifies that command line arguments in the form of \fB$NAME\fR should
+be replaced with the contents of the environment variable with the specified
+name. Note that no word-splitting is performed and the variable value always
+becomes a single argument; if the variable is not defined, it is replaced with
+an empty (zero-length) argument.
+.TP
+\fBinittab-id\fR = \fIid-string\fR
+When this service is started, if this setting (or the \fBinittab-line\fR setting) has a
+specified value, an entry will be created in the system "utmp" database which tracks
+processes and logged-in users. Typically this database is used by the "who" command to
+list logged-in users. The entry will be cleared when the service terminates.
+
+The \fBinittab-id\fR setting specifies the "inittab id" to be written in the entry for
+the process. The value is normally quite meaningless. However, it should be distinct
+(or unset) for separate processes. It is typically limited to a very short length.
+
+The "utmp" database is mostly a historical artifact. Access to it on some systems is
+prone to denial-of-service by unprivileged users. It is therefore recommended that this
+setting not be used. However, "who" and similar utilities may not work correctly without
+this setting (or \fBinittab-line\fR) enabled appropriately.
+
+This setting has no effect if Dinit was not built with support for writing to the "utmp"
+database.
+.TP
+\fBinittab-line\fR = \fItty-name-string\fR
+This specifies the tty line that will be written to the "utmp" database when this service
+is started. Normally, for a terminal login service, it would match the terminal device name
+on which the login process runs, without the "/dev/" prefix.
+
+See the description of the \fBinittab-id\fR setting for details.
+.TP
+\fBrlimit-nofile\fR = \fIresource-limits\fR
+Specifies the number of file descriptors that a process may have open simultaneously. See the
+\fBRESOURCE LIMITS\fR section.
+.TP
+\fBrlimit-core\fR = \fIresource-limits\fR
+Specifies the maximum size of the core dump file that will be generated for the process if it
+crashes (in a way that would result in a core dump). See the \fBRESOURCE LIMITS\fR section.
+.TP
+\fBrlimit-data\fR = \fIresource-limits\fR
+Specifies the maximum size of the data segment for the process, including statically allocated
+data and heap allocations. Precise meaning may vary between operating systems. See the
+\fBRESOURCE LIMITS\fR section.
+.TP
+\fBrlimit-addrspace\fR = \fIresource-limits\fR
+Specifies the maximum size of the address space of the process. See the \fBRESOURCE LIMITS\fR
+section. Note that some operating systems (notably OpenBSD) do not support this limit; the
+setting will be ignored on such systems.
+.\"
+.SS OPTIONS
+.\"
+These options are specified via the \fBoptions\fR parameter. 
+.\"
+.TP
+\fBno\-sigterm\fR
+Specifies that the TERM signal should not be send to the process to terminate
+it. (Another signal can be specified using the \fBtermsignal\fR setting; if no
+other signal is specified, no signal will be sent, which usually means that
+the service will not terminate).
+.TP
+\fBruns\-on\-console\fR
+Specifies that this service uses the console; its input and output should be
+directed to the console (or precisely, to the device to which Dinit's standard
+output stream is connected). A service running on the console prevents other
+services from running on the console (they will queue for the console).
+
+The \fIinterrupt\fR key (normally control-C) will be active for process / scripted
+services that run on the console. Handling of an interrupt is determined by
+the service process, but typically will cause it to terminate.
+.TP
+\fBstarts\-on\-console\fR
+Specifies that this service uses the console during service startup. This is
+implied by \fBruns-on-console\fR, but can be specified separately for services
+that need the console while they start but not afterwards.
+
+This setting is not applicable to regular \fBprocess\fR services, but can be
+used for \fBscripted\fR and \fBbgprocess\fR services. It allows for
+interrupting startup via the \fIinterrupt\fR key (normally control-C). This is
+useful to allow filesystem checks to be interrupted/skipped.
+
+This option is implied by \fBruns\-on\-console\fR, and is mutually exclusive
+with \fBshares\-console\fR; setting this option, or setting \fBruns\-on\-console\fR,
+unsets \fBshares\-console\fR.
+.TP
+\fBshares\-console\fR
+Specifies that this service should be given access to the console (input and output
+will be connected to the console), but that it should not exclusively hold the
+console and not delay the start of services with \fBstarts\-on\-console\fR.
+
+This is mutually exclusive with both \fBstarts\-on\-console\fR and \fBruns\-on\-console\fR;
+setting this option unsets both those options.
+.TP
+\fBstarts-rwfs\fR
+This service mounts the root filesystem read/write (or at least mounts the
+normal writable filesystems for the system). This prompts Dinit to create its
+control socket, if it has not already managed to do so.
+.TP
+\fBstarts-log\fR
+This service starts the system log daemon. Dinit will begin logging via the
+\fI/dev/log\fR socket.
+.TP
+\fBpass-cs-fd\fR
+Pass an open Dinit control socket to the process when launching it (the
+\fIDINIT_CS_FD\fR environment variable will be set to the file descriptor of
+the socket). This allows the service to issue commands to Dinit even if the
+regular control socket is not available yet.
+
+Using this option has security implications! The service which receives the
+control socket must close it before launching any untrusted processes. You
+should not use this option unless the service is designed to receive a Dinit
+control socket.
+.TP
+\fBstart-interruptible\fR
+This service can have its startup interrupted (cancelled) if it becomes inactive
+while still starting, by sending it the SIGINT signal. This is meaningful only
+for \fBbgprocess\fR and \fBscripted\fR services.
+.TP
+\fBskippable\fR
+For scripted services, indicates that if the service startup process terminates
+via an interrupt signal (SIGINT), then the service should be considered started.
+Note that if the interrupt was issued by Dinit to cancel startup, the service
+will instead be considered stopped.
+.TP
+\fBsignal-process-only\fR
+Signal the service process only, rather than its entire process group, whenever
+sending it a signal for any reason.
+.RE
+.LP
+The next section contains example service descriptions including some of the
+parameters and options described above.
+.\"
+.SS RESOURCE LIMITS
+.\"
+There are several settings for specifying process resource limits: \fBrlmit-nofile\fR,
+\fBrlimit-core\fR, \fBrlimit-data\fR and \fBrlimit-addrspace\fR. See the descriptions
+of each above. These settings place a limit on resource usage directly by the process.
+Note that resource limits are inherited by subprocesses, but that usage of a resource
+and subprocess are counted separately (in other words, a process can effectively bypass
+its resource limits by spawning a subprocess and allocating further resources within it).
+
+Resources have both a \fIhard\fR and \fIsoft\fR limit. The soft limit is the effective
+limit, but note that a process can raise its soft limit up to the hard limit for any
+given resource. Therefore the soft limit acts more as a sanity-check; a process can
+exceed the soft limit only by deliberately raising it first.
+
+Resource limits are specified in the following format:
+
+.RS
+\fIsoft-limit\fR:\fIhard-limit\fR
+.RE
+
+Either the soft limit or the hard limit can be omitted (in which case it will be unchanged).
+A limit can be specified as a dash, `\fB-\fR', in which case the limit will be removed. If
+only one value is specified with no colon separator, it affects both the soft and hard limit.
+.\"
+.SS EXAMPLES
+.LP
+Here is an example service description for the \fBmysql\fR database server.
+It has a dependency on the \fBrcboot\fR service (not shown) which is
+expected to have set up the system to a level suitable for basic operation.
+
+.RS
+.nf
+.gcolor blue
+.ft CR
+# mysqld service
+type = process
+command = /usr/bin/mysqld --user=mysql
+logfile = /var/log/mysqld.log
+smooth-recovery = true
+restart = false
+depends-on = rcboot # Basic system services must be ready
+.ft
+.gcolor
+.RE
+.fi
+.LP
+Here is an examples for a filesystem check "service", run by a script
+(\fI/etc/dinit.d/rootfscheck.sh\fR). The script may need to reboot the
+system, but the control socket may not have been created, so it uses the
+\fBpass-cs-fd\fR option to allow the \fBreboot\fR command to issue control
+commands to Dinit. It runs on the console, so that output is visible and
+the process can be interrupted using control-C, in which case the check is
+skipped but dependent services continue to start.
+
+.RS
+.nf
+.gcolor blue
+.ft CR
+# rootfscheck service
+type = scripted
+command = /etc/dinit.d/rootfscheck.sh
+restart = false
+options = starts-on-console pass-cs-fd
+options = start-interruptible skippable
+depends-on = early-filesystems  # /proc and /dev
+depends-on = device-node-daemon
+.ft
+.gcolor
+.fi
+.RE
+
+More examples are provided with the Dinit distribution.
+.\"
+.SH AUTHOR
+Dinit, and this manual, were written by Davin McCall.
+$$$dnl
diff --git a/doc/manpages/dinit.8 b/doc/manpages/dinit.8
deleted file mode 100644 (file)
index 91f2556..0000000
+++ /dev/null
@@ -1,177 +0,0 @@
-.TH DINIT "8" "June 2019" "Dinit 0.5.2" "Dinit \- service management system"
-.SH NAME
-dinit \- supervise processes and manage services
-.\"
-.SH SYNOPSIS
-.\"
-.HP \w'\ 'u
-.B dinit
-[\fB\-s\fR|\fB\-\-system\fR|\fB\-u\fR|\fB\-\-user\fR] [\fB\-d\fR|\fB\-\-services\-dir\fR \fIdir\fR]
-[\fB\-p\fR|\fB\-\-socket\-path\fR \fIpath\fR] [\fB\-e\fR|\fB\-\-env\-file\fR \fIpath\fR]
-[\fB\-l\fR|\fB\-\-log\-file\fR \fIpath\fR]
-[\fIservice-name\fR...]
-.\"
-.SH DESCRIPTION
-.\"
-\fBDinit\fR is a process supervisor and service manager which can also
-function as a system \fBinit\fR process. It has a small but functional
-feature set, offering service dependency handling, parallel startup,
-automatic rate-limited restart of failing processes, and service control
-functions.
-
-Dinit can be run as a system instance (when run as the root user or when
-specified via command line parameter) or as a user instance. This affects
-the default paths used to locate certain files.
-
-When run as PID 1, the first process, Dinit acts as a system manager and
-shuts down or reboots the system on request (including on receipt of
-certain signals). This is currently fully supported only on Linux. See
-\fBRUNNING AS SYSTEM MANAGER / PRIMARY INIT\fR.
-
-Dinit reads service descriptions from files located in a service
-description directory, normally one of \fI/etc/dinit.d\fR,
-\fI/usr/local/lib/dinit.d\fR or \fI/lib/dinit.d\fR for the system instance
-or just \fI$HOME/dinit.d\fR when run as a user process. See \fBSERVICE
-DESCRIPTION FILES\fR for details of the service description format.
-.\"
-.SH OPTIONS
-.TP
-\fB\-d\fR \fIdir\fP, \fB\-\-services\-dir\fR \fIdir\fP
-Specifies \fIdir\fP as the directory containing service definition files.
-The directory specified will be the only directory searched for service
-definitions.
-
-If not specified, the default is \fI$HOME/dinit.d\fR or, for the
-system service manager, each of \fI/etc/dinit.d/fR, \fI/usr/local/lib/dinit.d\fR,
-and \fI/lib/dinit.d\fR (searched in that order).
-.TP
-\fB\-e\fR \fIfile\fP, \fB\-\-env\-file\fR \fIfile\fP
-Read initial environment from \fIfile\fP. For the system init process, the
-default is \fI/etc/dinit/environment\fR; see \fBFILES\fR.
-.TP
-\fB\-p\fR \fIpath\fP, \fB\-\-socket\-path\fR \fIpath\fP
-Specifies \fIpath\fP as the path to the control socket used to listen for
-commands from the \fBdinitctl\fR program. The default for the system service
-manager is usually \fI/dev/dinitctl\fR (but can be configured at build time).
-For a user service manager the default is \fI$HOME/.dinitctl\fR.
-.TP
-\fB\-l\fR \fIpath\fP, \fB\-\-log\-file\fR \fIpath\fP
-Species \fIpath\fP as the path to the log file, to which Dinit will log status
-and error messages. Note that when running as the system service manager, Dinit
-does not begin logging until the log service has started. Using this option
-inhibits logging via the syslog facility, however, all logging messages are
-duplicated as usual to the console (so long as no service owns the console).
-.TP
-\fB\-s\fR, \fB\-\-system\fR
-Run as the system service manager. This is the default if invoked as the root
-user. This option affects the default service definition directory and control
-socket path.
-.TP
-\fB\-u\fR, \fB\-\-user\fR
-Run as a user. This is the opposite of \fB\-\-system\fR, and is the default if
-not invoked as the root user.
-.TP
-\fB\-q\fR, \fB\-\-quiet\fR
-Run with no output to the terminal/console. This disables service status messages
-and sets the log level for the console log to \fBNONE\fR.
-.TP
-\fB\-\-help\fR
-display this help and exit
-.TP
-\fIservice-name\fR
-Specifies the name of a service that should be started (along with its
-dependencies). If none are specified, defaults to \fIboot\fR (which requires
-that a suitable service description for the \fIboot\fR service exists).
-.\"
-.SH SERVICE DESCRIPTION FILES
-.\"
-Service description files specify the parameters of each service. They are
-named for the service they describe, and are found in \fI/etc/dinit.d\fR
-for a system instance or \fI$HOME/dinit.d\fR for a user instance.
-
-Service description files are read by Dinit on an "as needed" basis. Once a
-service description has been read the configuration can be altered in limited
-ways via the \fBdinitctl\fR(8) program.
-
-See \fBdinit-service\fR(5) for details of the format and available parameters.
-.\"
-.SH SPECIAL SERVICE NAMES
-.\"
-There are two service names that are "special" to Dinit.
-
-The \fIboot\fR service is the service that Dinit starts by default, if no
-other service names are provided when it is started.
-
-The \fIrecovery\fR service is a service that Dinit will offer to start if
-boot appears to fail (that is, if all services stop without a shutdown command
-having been issued), when Dinit is running as system manager.
-.\"
-.SH OPERATION
-.\"
-On starting, Dinit starts the initial service(s) as specified on the command
-line. Starting a service also causes the dependencies of that service to
-start, and any service processes will not be launched until the dependencies
-are satisfied. Similarly, stopping a service first stops any dependent
-services.
-
-During execution, Dinit accepts commands via a control socket which is created
-by Dinit when it starts. This can be used to order that a service be started
-or stopped, to determine service status, or to make certain configuration
-changes. See \fBdinitctl\fR(8) for details.
-
-Process-based services are monitored and, if the process terminates, the
-service may be stopped or the process may be re-started, according to the
-configuration in the service description.  
-
-Once all services stop, the \fBdinit\fR daemon will itself terminate (or, if
-running as PID 1, will perform the appropriate type of system shutdown).
-.\"
-.SS CHARACTER SET HANDLING
-.\"
-Dinit does no character set translation. Dinit's own output is in the execution
-character set as determined at compilation, as is the interpretation of input.
-Service names (and other user-defined inputs) are interpreted as byte sequences
-and are output as they were read. In general, modern systems use the UTF-8
-character set universally and no problems will arise; however, systems configured
-to use other character sets may see odd behaviour if the input character set does
-not match the output character set, or if either input or output character sets
-are not a superset of the execution character set.
-.\"
-.SS RUNNING AS SYSTEM MANAGER / PRIMARY INIT
-.\"
-Running as the system manager (primary \fBinit\fR) is currently supported only on
-Linux. When run as process ID 1, the \fBdinit\fR daemon assumes responsibility for
-system shutdown and restart (partially relying on external utilities which are
-part of the Dinit distribution).
-
-When not running as process ID 1, \fBdinit\fR assumes responsibility only for
-service management. System shutdown or restart need to be handled by the primary
-\fBinit\fR, which should start \fBdinit\fR on normal startup, and terminate
-\fBdinit\fR before shutdown, by signalling it and waiting for it to terminate
-after stopping services (possibly by invoking \fBdinitctl shutdown\fR).
-.\"
-.SH FILES
-.\"
-.TP
-\fI/etc/dinit/environment\fR
-Default location of the environment file for Dinit when run as a system
-instance (for user instances there is no default). Values are specified as
-\fINAME\fR=\fIVALUE\fR, one per line, and add to and replace variables present
-in the environment when Dinit started. Lines beginning with a hash character
-(#) are ignored.
-.\"
-.SH SIGNALS
-.LP
-When run as a system manager, SIGINT stops all services and performs a reboot (on Linux, this signal can be
-generated using the control-alt-delete key combination); SIGTERM stops services and halts the system; and
-SIGQUIT performs an immediate shutdown with no service rollback.
-.LP
-When run as a user process or system service manager only, SIGINT and SIGTERM both stop services
-and exit Dinit; SIGQUIT exits Dinit immediately.
-.\"
-.SH SEE ALSO
-.\"
-\fBdinitctl\fR(8), \fBdinit-service\fR(5).
-.\"
-.SH AUTHOR
-Dinit, and this manual, were written by Davin McCall.
diff --git a/doc/manpages/dinit.8.m4 b/doc/manpages/dinit.8.m4
new file mode 100644 (file)
index 0000000..0da6cdd
--- /dev/null
@@ -0,0 +1,179 @@
+changequote(`@@@',`$$$')dnl
+@@@.TH DINIT "8" "$$$MONTH YEAR@@@" "Dinit $$$VERSION@@@" "Dinit \- service management system"
+.SH NAME
+dinit \- supervise processes and manage services
+.\"
+.SH SYNOPSIS
+.\"
+.HP \w'\ 'u
+.B dinit
+[\fB\-s\fR|\fB\-\-system\fR|\fB\-u\fR|\fB\-\-user\fR] [\fB\-d\fR|\fB\-\-services\-dir\fR \fIdir\fR]
+[\fB\-p\fR|\fB\-\-socket\-path\fR \fIpath\fR] [\fB\-e\fR|\fB\-\-env\-file\fR \fIpath\fR]
+[\fB\-l\fR|\fB\-\-log\-file\fR \fIpath\fR]
+[\fIservice-name\fR...]
+.\"
+.SH DESCRIPTION
+.\"
+\fBDinit\fR is a process supervisor and service manager which can also
+function as a system \fBinit\fR process. It has a small but functional
+feature set, offering service dependency handling, parallel startup,
+automatic rate-limited restart of failing processes, and service control
+functions.
+
+Dinit can be run as a system instance (when run as the root user or when
+specified via command line parameter) or as a user instance. This affects
+the default paths used to locate certain files.
+
+When run as PID 1, the first process, Dinit acts as a system manager and
+shuts down or reboots the system on request (including on receipt of
+certain signals). This is currently fully supported only on Linux. See
+\fBRUNNING AS SYSTEM MANAGER / PRIMARY INIT\fR.
+
+Dinit reads service descriptions from files located in a service
+description directory, normally one of \fI/etc/dinit.d\fR,
+\fI/usr/local/lib/dinit.d\fR or \fI/lib/dinit.d\fR for the system instance
+or just \fI$HOME/dinit.d\fR when run as a user process. See \fBSERVICE
+DESCRIPTION FILES\fR for details of the service description format.
+.\"
+.SH OPTIONS
+.TP
+\fB\-d\fR \fIdir\fP, \fB\-\-services\-dir\fR \fIdir\fP
+Specifies \fIdir\fP as the directory containing service definition files.
+The directory specified will be the only directory searched for service
+definitions.
+
+If not specified, the default is \fI$HOME/dinit.d\fR or, for the
+system service manager, each of \fI/etc/dinit.d/fR, \fI/usr/local/lib/dinit.d\fR,
+and \fI/lib/dinit.d\fR (searched in that order).
+.TP
+\fB\-e\fR \fIfile\fP, \fB\-\-env\-file\fR \fIfile\fP
+Read initial environment from \fIfile\fP. For the system init process, the
+default is \fI/etc/dinit/environment\fR; see \fBFILES\fR.
+.TP
+\fB\-p\fR \fIpath\fP, \fB\-\-socket\-path\fR \fIpath\fP
+Specifies \fIpath\fP as the path to the control socket used to listen for
+commands from the \fBdinitctl\fR program. The default for the system service
+manager is usually \fI/dev/dinitctl\fR (but can be configured at build time).
+For a user service manager the default is \fI$HOME/.dinitctl\fR.
+.TP
+\fB\-l\fR \fIpath\fP, \fB\-\-log\-file\fR \fIpath\fP
+Species \fIpath\fP as the path to the log file, to which Dinit will log status
+and error messages. Note that when running as the system service manager, Dinit
+does not begin logging until the log service has started. Using this option
+inhibits logging via the syslog facility, however, all logging messages are
+duplicated as usual to the console (so long as no service owns the console).
+.TP
+\fB\-s\fR, \fB\-\-system\fR
+Run as the system service manager. This is the default if invoked as the root
+user. This option affects the default service definition directory and control
+socket path.
+.TP
+\fB\-u\fR, \fB\-\-user\fR
+Run as a user. This is the opposite of \fB\-\-system\fR, and is the default if
+not invoked as the root user.
+.TP
+\fB\-q\fR, \fB\-\-quiet\fR
+Run with no output to the terminal/console. This disables service status messages
+and sets the log level for the console log to \fBNONE\fR.
+.TP
+\fB\-\-help\fR
+display this help and exit
+.TP
+\fIservice-name\fR
+Specifies the name of a service that should be started (along with its
+dependencies). If none are specified, defaults to \fIboot\fR (which requires
+that a suitable service description for the \fIboot\fR service exists).
+.\"
+.SH SERVICE DESCRIPTION FILES
+.\"
+Service description files specify the parameters of each service. They are
+named for the service they describe, and are found in \fI/etc/dinit.d\fR
+for a system instance or \fI$HOME/dinit.d\fR for a user instance.
+
+Service description files are read by Dinit on an "as needed" basis. Once a
+service description has been read the configuration can be altered in limited
+ways via the \fBdinitctl\fR(8) program.
+
+See \fBdinit-service\fR(5) for details of the format and available parameters.
+.\"
+.SH SPECIAL SERVICE NAMES
+.\"
+There are two service names that are "special" to Dinit.
+
+The \fIboot\fR service is the service that Dinit starts by default, if no
+other service names are provided when it is started.
+
+The \fIrecovery\fR service is a service that Dinit will offer to start if
+boot appears to fail (that is, if all services stop without a shutdown command
+having been issued), when Dinit is running as system manager.
+.\"
+.SH OPERATION
+.\"
+On starting, Dinit starts the initial service(s) as specified on the command
+line. Starting a service also causes the dependencies of that service to
+start, and any service processes will not be launched until the dependencies
+are satisfied. Similarly, stopping a service first stops any dependent
+services.
+
+During execution, Dinit accepts commands via a control socket which is created
+by Dinit when it starts. This can be used to order that a service be started
+or stopped, to determine service status, or to make certain configuration
+changes. See \fBdinitctl\fR(8) for details.
+
+Process-based services are monitored and, if the process terminates, the
+service may be stopped or the process may be re-started, according to the
+configuration in the service description.  
+
+Once all services stop, the \fBdinit\fR daemon will itself terminate (or, if
+running as PID 1, will perform the appropriate type of system shutdown).
+.\"
+.SS CHARACTER SET HANDLING
+.\"
+Dinit does no character set translation. Dinit's own output is in the execution
+character set as determined at compilation, as is the interpretation of input.
+Service names (and other user-defined inputs) are interpreted as byte sequences
+and are output as they were read. In general, modern systems use the UTF-8
+character set universally and no problems will arise; however, systems configured
+to use other character sets may see odd behaviour if the input character set does
+not match the output character set, or if either input or output character sets
+are not a superset of the execution character set.
+.\"
+.SS RUNNING AS SYSTEM MANAGER / PRIMARY INIT
+.\"
+Running as the system manager (primary \fBinit\fR) is currently supported only on
+Linux. When run as process ID 1, the \fBdinit\fR daemon assumes responsibility for
+system shutdown and restart (partially relying on external utilities which are
+part of the Dinit distribution).
+
+When not running as process ID 1, \fBdinit\fR assumes responsibility only for
+service management. System shutdown or restart need to be handled by the primary
+\fBinit\fR, which should start \fBdinit\fR on normal startup, and terminate
+\fBdinit\fR before shutdown, by signalling it and waiting for it to terminate
+after stopping services (possibly by invoking \fBdinitctl shutdown\fR).
+.\"
+.SH FILES
+.\"
+.TP
+\fI/etc/dinit/environment\fR
+Default location of the environment file for Dinit when run as a system
+instance (for user instances there is no default). Values are specified as
+\fINAME\fR=\fIVALUE\fR, one per line, and add to and replace variables present
+in the environment when Dinit started. Lines beginning with a hash character
+(#) are ignored.
+.\"
+.SH SIGNALS
+.LP
+When run as a system manager, SIGINT stops all services and performs a reboot (on Linux, this signal can be
+generated using the control-alt-delete key combination); SIGTERM stops services and halts the system; and
+SIGQUIT performs an immediate shutdown with no service rollback.
+.LP
+When run as a user process or system service manager only, SIGINT and SIGTERM both stop services
+and exit Dinit; SIGQUIT exits Dinit immediately.
+.\"
+.SH SEE ALSO
+.\"
+\fBdinitctl\fR(8), \fBdinit-service\fR(5).
+.\"
+.SH AUTHOR
+Dinit, and this manual, were written by Davin McCall.
+$$$dnl
diff --git a/doc/manpages/dinitctl.8 b/doc/manpages/dinitctl.8
deleted file mode 100644 (file)
index 02d57a5..0000000
+++ /dev/null
@@ -1,183 +0,0 @@
-.TH DINITCTL "8" "June 2019" "Dinit 0.5.2" "Dinit \- service management system"
-.SH NAME
-dinitctl \- control services supervised by Dinit
-.\"
-.SH SYNOPSIS
-.\"
-.B dinitctl
-[\fIoptions\fR] \fBstart\fR [\fB\-\-no\-wait\fR] [\fB\-\-pin\fR] \fIservice-name\fR
-.br
-.B dinitctl
-[\fIoptions\fR] \fBstop\fR [\fB\-\-no\-wait\fR] [\fB\-\-pin\fR] \fIservice-name\fR
-.br
-.B dinitctl
-[\fIoptions\fR] \fBwake\fR [\fB\-\-no\-wait\fR] \fIservice-name\fR
-.br
-.B dinitctl
-[\fIoptions\fR] \fBrelease\fR \fIservice-name\fR
-.br
-.B dinitctl
-[\fIoptions\fR] \fBunpin\fR \fIservice-name\fR
-.br
-.B dinitctl
-[\fIoptions\fR] \fBunload\fR \fIservice-name\fR
-.br
-.B dinitctl
-[\fIoptions\fR] \fBlist\fR
-.br
-.B dinitctl
-[\fIoptions\fR] \fBshutdown\fR
-.br
-.B dinitctl
-[\fIoptions\fR] \fBadd-dep\fR \fIdependency-type\fR \fIfrom-service\fR \fIto-service\fR
-.br
-.B dinitctl
-[\fIoptions\fR] \fBrm-dep\fR \fIdependency-type\fR \fIfrom-service\fR \fIto-service\fR
-.br
-.B dinitctl
-[\fIoptions\fR] \fBenable\fR [\fB\-\-from\fR \fIfrom-service\fR] \fIto-service\fR
-.br
-.B dinitctl
-[\fIoptions\fR] \fBdisable\fR [\fB\-\-from\fR \fIfrom-service\fR] \fIto-service\fR
-.\"
-.SH DESCRIPTION
-.\"
-\fBdinitctl\fR is a utility to control services being managed by the
-\fBdinit\fR daemon. It allows starting and stopping services, and listing
-service status. 
-.\"
-.SH GENERAL OPTIONS
-.TP
-\fB\-\-help\fR
-display this help and exit
-.TP
-\fB\-s\fR, \fB\-\-system\fR
-Control the system init process. The default is to control the user process. This option selects
-the path to the control socket used to communicate with the \fBdinit\fR daemon process.
-.TP
-\fB\-\-socket\-path\fR \fIsocket-path\fR, \fB\-p\fR \fIsocket-path\fR
-Specify the path to the socket used for communicating with the service manager daemon.
-.TP
-\fB\-\-quiet\fR
-Suppress status output, except for errors. 
-.\"
-.SH COMMAND OPTIONS
-.TP
-\fB\-\-no\-wait\fR
-Do not wait for issued command to complete; exit immediately.
-.TP
-\fB\-\-pin\fR
-Pin the service in the requested state. The service will not leave the state until it is unpinned, although
-start/stop commands will be "remembered" while the service is pinned.
-.TP
-\fIservice-name\fR
-Specifies the name of the service to which the command applies.
-.TP
-\fBstart\fR
-Start the specified service. The service is marked as explicitly activated and will not be stopped
-automatically if its dependents stop. If the service is currently stopping it will generally continue
-to stop before it is then restarted.
-.TP
-\fBstop\fR
-Stop the specified service, and remove explicit activation. The service will stop, but may restart
-immediately if any dependents are configured to restart. If the service has dependents only via
-soft dependency links (i.e. \fBwaits-for\fR dependencies) then these links will be broken, so that
-the service will not restart (any other dependencies, however, are retained).
-
-The \fBrestart\fR option applied to the stopped service will not by itself cause the service to restart
-when it is stopped via this command. However, a dependent which is configured to restart may
-cause the service itself to restart as a result.
-
-Any pending \fBstart\fR orders are cancelled,
-though a service which is starting might continue its startup before then stopping.
-.TP
-\fBwake\fR
-Start the specified service, but do not mark it as explicitly activated if it is not already so
-marked.
-.TP
-\fBrelease\fR
-Clear the explicit activation mark from a service (service will then stop if it has no active dependents).
-.TP
-\fBunpin\fR
-Remove start- and stop- pins from a service. If a started service is not explicitly activated and
-has no active dependents, it will stop. If a started service has a dependency service which is stopping,
-it will stop. If a stopped service has a dependent service which is starting, it will start. Otherwise,
-any pending start/stop commands will be carried out.
-.TP
-\fBunload\fR
-Completely unload a service. This can only be done if the service is stopped and has no loaded dependents
-(i.e. dependents must be unloaded before their dependencies).
-.TP
-\fBlist\fR
-List loaded services and their state. Before each service, one of the following state indicators is
-displayed:
-
-.RS
-.nf
-\f[C]\m[blue][{+}\ \ \ \ \ ]\m[]\fR \[em] service has started.
-\f[C]\m[blue][{\ }<<\ \ \ ]\m[]\fR \[em] service is starting.
-\f[C]\m[blue][\ \ \ <<{\ }]\m[]\fR \[em] service is starting, will stop once started.
-\f[C]\m[blue][{\ }>>\ \ \ ]\m[]\fR \[em] service is stopping, will start once stopped.
-\f[C]\m[blue][\ \ \ >>{\ }]\m[]\fR \[em] service is stopping.
-\f[C]\m[blue][\ \ \ \ \ {-}]\m[]\fR \[em] service has stopped.
-.fi
-
-The << and >> symbols represent a transition state (starting and stopping respectively); curly braces
-indicate the desired state (left: started, right: stopped). An 's' in place of '+' means that service
-startup was skipped (possible only if the service is configured as skippable). An 'X' in place of '-'
-means that the service failed to start, or that the service process unexpectedly terminated with an
-error status or signal while running.
-
-Additional information, if available, will be printed after the service name: whether the service owns,
-or is waiting to acquire, the console; the process ID; the exit status or signal that caused termination.
-.RE
-.TP
-\fBshutdown\fR
-Stop all services (without restart) and terminate Dinit. If issued to the system instance of Dinit,
-this will also shut down the system.
-.TP
-\fBadd-dep\fR
-Add a dependency between two services. The \fIdependency-type\fR must be one of \fBregular\fR,
-\fBmilestone\fR or \fBwaits-for\fR. Note that adding a regular dependency requires that the service
-states are consistent with the dependency (i.e. if the "from" service is started, the "to" service
-must also be started). Circular dependency chains may not be created.
-.TP
-\fBrm-dep\fR
-Remove a dependency between two services. The \fIdependency-type\fR must be one of \fBregular\fR,
-\fBmilestone\fR or \fBwaits-for\fR. If the "to" service is not otherwise active it may be stopped
-as a result of removing the dependency.  
-.TP
-\fBenable\fR
-Permanently enable a \fBwaits-for\fR dependency between two services. This is much like \fBadd-dep\fR
-but it also starts the dependency if the dependent is started (without explicit activation, so the
-dependency will stop if the dependent stops), and it creates a symbolic link in the directory
-specified via the \fBwaits-for.d\fR directive in the service description (there must be only one such
-directive). The dependency should therefore be persistent.
-
-If the \fB--from\fR option is not used to specify the dependent, the dependency is created from the
-\fBboot\fR service by default.
-.TP
-\fBdisable\fR
-Permanently disable a \fBwaits-for\fR dependency between two services. This is the complement of the
-\fBenable\fR command; see the description above for more information.
-.\"
-.SH SERVICE OPERATION
-.\"
-Normally, services are only started if they have been explicitly activated (\fBstart\fR command) or if
-a started service depends on them. Therefore, starting a service also starts all services that the first
-depends on; stopping the same service then also stops the dependency services, unless they are also
-required by another explicitly activated service.
-.LP
-A service can be pinned in either the started or stopped state. This is mainly intended to be used to
-prevent automated stop or start of a service, including via a dependency or dependent service, during
-a manual administrative procedure.
-.LP
-Stopping a service does not in general prevent it from restarting. A service configured to restart
-automatically, or with a dependent service configured to do so, will restart immediately after stopping
-unless pinned.
-.\"
-.SH SEE ALSO
-\fBdinit\fR(8).
-.\"
-.SH AUTHOR
-Dinit, and this manual, were written by Davin McCall.
diff --git a/doc/manpages/dinitctl.8.m4 b/doc/manpages/dinitctl.8.m4
new file mode 100644 (file)
index 0000000..cee4b02
--- /dev/null
@@ -0,0 +1,185 @@
+changequote(`@@@',`$$$')dnl
+@@@.TH DINITCTL "8" "$$$MONTH YEAR@@@" "Dinit $$$VERSION@@@" "Dinit \- service management system"
+.SH NAME
+dinitctl \- control services supervised by Dinit
+.\"
+.SH SYNOPSIS
+.\"
+.B dinitctl
+[\fIoptions\fR] \fBstart\fR [\fB\-\-no\-wait\fR] [\fB\-\-pin\fR] \fIservice-name\fR
+.br
+.B dinitctl
+[\fIoptions\fR] \fBstop\fR [\fB\-\-no\-wait\fR] [\fB\-\-pin\fR] \fIservice-name\fR
+.br
+.B dinitctl
+[\fIoptions\fR] \fBwake\fR [\fB\-\-no\-wait\fR] \fIservice-name\fR
+.br
+.B dinitctl
+[\fIoptions\fR] \fBrelease\fR \fIservice-name\fR
+.br
+.B dinitctl
+[\fIoptions\fR] \fBunpin\fR \fIservice-name\fR
+.br
+.B dinitctl
+[\fIoptions\fR] \fBunload\fR \fIservice-name\fR
+.br
+.B dinitctl
+[\fIoptions\fR] \fBlist\fR
+.br
+.B dinitctl
+[\fIoptions\fR] \fBshutdown\fR
+.br
+.B dinitctl
+[\fIoptions\fR] \fBadd-dep\fR \fIdependency-type\fR \fIfrom-service\fR \fIto-service\fR
+.br
+.B dinitctl
+[\fIoptions\fR] \fBrm-dep\fR \fIdependency-type\fR \fIfrom-service\fR \fIto-service\fR
+.br
+.B dinitctl
+[\fIoptions\fR] \fBenable\fR [\fB\-\-from\fR \fIfrom-service\fR] \fIto-service\fR
+.br
+.B dinitctl
+[\fIoptions\fR] \fBdisable\fR [\fB\-\-from\fR \fIfrom-service\fR] \fIto-service\fR
+.\"
+.SH DESCRIPTION
+.\"
+\fBdinitctl\fR is a utility to control services being managed by the
+\fBdinit\fR daemon. It allows starting and stopping services, and listing
+service status. 
+.\"
+.SH GENERAL OPTIONS
+.TP
+\fB\-\-help\fR
+display this help and exit
+.TP
+\fB\-s\fR, \fB\-\-system\fR
+Control the system init process. The default is to control the user process. This option selects
+the path to the control socket used to communicate with the \fBdinit\fR daemon process.
+.TP
+\fB\-\-socket\-path\fR \fIsocket-path\fR, \fB\-p\fR \fIsocket-path\fR
+Specify the path to the socket used for communicating with the service manager daemon.
+.TP
+\fB\-\-quiet\fR
+Suppress status output, except for errors. 
+.\"
+.SH COMMAND OPTIONS
+.TP
+\fB\-\-no\-wait\fR
+Do not wait for issued command to complete; exit immediately.
+.TP
+\fB\-\-pin\fR
+Pin the service in the requested state. The service will not leave the state until it is unpinned, although
+start/stop commands will be "remembered" while the service is pinned.
+.TP
+\fIservice-name\fR
+Specifies the name of the service to which the command applies.
+.TP
+\fBstart\fR
+Start the specified service. The service is marked as explicitly activated and will not be stopped
+automatically if its dependents stop. If the service is currently stopping it will generally continue
+to stop before it is then restarted.
+.TP
+\fBstop\fR
+Stop the specified service, and remove explicit activation. The service will stop, but may restart
+immediately if any dependents are configured to restart. If the service has dependents only via
+soft dependency links (i.e. \fBwaits-for\fR dependencies) then these links will be broken, so that
+the service will not restart (any other dependencies, however, are retained).
+
+The \fBrestart\fR option applied to the stopped service will not by itself cause the service to restart
+when it is stopped via this command. However, a dependent which is configured to restart may
+cause the service itself to restart as a result.
+
+Any pending \fBstart\fR orders are cancelled,
+though a service which is starting might continue its startup before then stopping.
+.TP
+\fBwake\fR
+Start the specified service, but do not mark it as explicitly activated if it is not already so
+marked.
+.TP
+\fBrelease\fR
+Clear the explicit activation mark from a service (service will then stop if it has no active dependents).
+.TP
+\fBunpin\fR
+Remove start- and stop- pins from a service. If a started service is not explicitly activated and
+has no active dependents, it will stop. If a started service has a dependency service which is stopping,
+it will stop. If a stopped service has a dependent service which is starting, it will start. Otherwise,
+any pending start/stop commands will be carried out.
+.TP
+\fBunload\fR
+Completely unload a service. This can only be done if the service is stopped and has no loaded dependents
+(i.e. dependents must be unloaded before their dependencies).
+.TP
+\fBlist\fR
+List loaded services and their state. Before each service, one of the following state indicators is
+displayed:
+
+.RS
+.nf
+\f[C]\m[blue][{+}\ \ \ \ \ ]\m[]\fR \[em] service has started.
+\f[C]\m[blue][{\ }<<\ \ \ ]\m[]\fR \[em] service is starting.
+\f[C]\m[blue][\ \ \ <<{\ }]\m[]\fR \[em] service is starting, will stop once started.
+\f[C]\m[blue][{\ }>>\ \ \ ]\m[]\fR \[em] service is stopping, will start once stopped.
+\f[C]\m[blue][\ \ \ >>{\ }]\m[]\fR \[em] service is stopping.
+\f[C]\m[blue][\ \ \ \ \ {-}]\m[]\fR \[em] service has stopped.
+.fi
+
+The << and >> symbols represent a transition state (starting and stopping respectively); curly braces
+indicate the desired state (left: started, right: stopped). An 's' in place of '+' means that service
+startup was skipped (possible only if the service is configured as skippable). An 'X' in place of '-'
+means that the service failed to start, or that the service process unexpectedly terminated with an
+error status or signal while running.
+
+Additional information, if available, will be printed after the service name: whether the service owns,
+or is waiting to acquire, the console; the process ID; the exit status or signal that caused termination.
+.RE
+.TP
+\fBshutdown\fR
+Stop all services (without restart) and terminate Dinit. If issued to the system instance of Dinit,
+this will also shut down the system.
+.TP
+\fBadd-dep\fR
+Add a dependency between two services. The \fIdependency-type\fR must be one of \fBregular\fR,
+\fBmilestone\fR or \fBwaits-for\fR. Note that adding a regular dependency requires that the service
+states are consistent with the dependency (i.e. if the "from" service is started, the "to" service
+must also be started). Circular dependency chains may not be created.
+.TP
+\fBrm-dep\fR
+Remove a dependency between two services. The \fIdependency-type\fR must be one of \fBregular\fR,
+\fBmilestone\fR or \fBwaits-for\fR. If the "to" service is not otherwise active it may be stopped
+as a result of removing the dependency.  
+.TP
+\fBenable\fR
+Permanently enable a \fBwaits-for\fR dependency between two services. This is much like \fBadd-dep\fR
+but it also starts the dependency if the dependent is started (without explicit activation, so the
+dependency will stop if the dependent stops), and it creates a symbolic link in the directory
+specified via the \fBwaits-for.d\fR directive in the service description (there must be only one such
+directive). The dependency should therefore be persistent.
+
+If the \fB--from\fR option is not used to specify the dependent, the dependency is created from the
+\fBboot\fR service by default.
+.TP
+\fBdisable\fR
+Permanently disable a \fBwaits-for\fR dependency between two services. This is the complement of the
+\fBenable\fR command; see the description above for more information.
+.\"
+.SH SERVICE OPERATION
+.\"
+Normally, services are only started if they have been explicitly activated (\fBstart\fR command) or if
+a started service depends on them. Therefore, starting a service also starts all services that the first
+depends on; stopping the same service then also stops the dependency services, unless they are also
+required by another explicitly activated service.
+.LP
+A service can be pinned in either the started or stopped state. This is mainly intended to be used to
+prevent automated stop or start of a service, including via a dependency or dependent service, during
+a manual administrative procedure.
+.LP
+Stopping a service does not in general prevent it from restarting. A service configured to restart
+automatically, or with a dependent service configured to do so, will restart immediately after stopping
+unless pinned.
+.\"
+.SH SEE ALSO
+\fBdinit\fR(8).
+.\"
+.SH AUTHOR
+Dinit, and this manual, were written by Davin McCall.
+$$$dnl
diff --git a/doc/manpages/shutdown.8 b/doc/manpages/shutdown.8
deleted file mode 100644 (file)
index e04e47a..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-.TH SHUTDOWN "8" "June 2019" "Dinit 0.5.2" "Dinit \- service management system"
-.SH NAME
-shutdown, halt, reboot \- system shutdown 
-.\"
-.SH SYNOPSIS
-.\"
-.B shutdown
-[\fB\-r\fR|\fB\-h\fR|\fB\-p\fR] [\fB\-\-use\-passed\-cfd\fR]
-[\fB\-\-system\fR]
-.br
-\fBhalt\fR [\fIoptions...\fR]
-.br
-\fBreboot\fR [\fIoptions...\fR]
-.\"
-.SH DESCRIPTION
-.\"
-This manual page is for the shutdown utility included with the \fBDinit\fR
-service manager package. See \fBdinit\fR(8).
-
-The shutdown, reboot and halt commands can be used to instruct the service
-manager daemon to perform a service rollback and then to shutdown the
-system. They can also perform shutdown directly, without service rollback.
-
-Note that for consistency with other packages a "halt" alias is provided,
-however it has no special significance. Note that the default action is to
-power down the system.
-.\"
-.SH OPTIONS
-.TP
-\fB\-r\fP
-Request a shutdown followed by restart. This is the default if executed as
-\fBreboot\fR.
-.TP
-\fB\-h\fP
-Shutdown and then halt the system (without powering down).
-.TP
-\fB\-p\fP
-Shutdown and then power down the system. This is the default unless executed
-as \fBreboot\fR.
-.TP
-\fB\-\-use\-passed\-cfd\fR
-Instead of attempting to open a socket connection to the service daemon,
-use a pre-opened connection that has been passed to the process from its parent
-via an open file descriptor. The file descriptor with the connection is identifed
-by the DINIT_CS_FD environment variable.
-.TP
-\fB\-\-system\fR
-Shut down directly, instead of by issuing a command to the service manager. Use of
-this option should be avoided, but it may allow performing a clean shutdown in case
-the service manager has stopped responding.
-
-The service manager may invoke \fBshutdown\fR with this option in order to perform
-system shutdown after it has rolled back services.
-.\"
-.SH SEE ALSO
-.\"
-\fBdinit\fR(8), \fBdinitctl\fR(8)
-.\"
-.SH AUTHOR
-Dinit, and this manual, were written by Davin McCall.
diff --git a/doc/manpages/shutdown.8.m4 b/doc/manpages/shutdown.8.m4
new file mode 100644 (file)
index 0000000..37b15b8
--- /dev/null
@@ -0,0 +1,62 @@
+changequote(`@@@',`$$$')dnl
+@@@.TH SHUTDOWN "8" "$$$MONTH YEAR@@@" "Dinit $$$VERSION@@@" "Dinit \- service management system"
+.SH NAME
+shutdown, halt, reboot \- system shutdown 
+.\"
+.SH SYNOPSIS
+.\"
+.B shutdown
+[\fB\-r\fR|\fB\-h\fR|\fB\-p\fR] [\fB\-\-use\-passed\-cfd\fR]
+[\fB\-\-system\fR]
+.br
+\fBhalt\fR [\fIoptions...\fR]
+.br
+\fBreboot\fR [\fIoptions...\fR]
+.\"
+.SH DESCRIPTION
+.\"
+This manual page is for the shutdown utility included with the \fBDinit\fR
+service manager package. See \fBdinit\fR(8).
+
+The shutdown, reboot and halt commands can be used to instruct the service
+manager daemon to perform a service rollback and then to shutdown the
+system. They can also perform shutdown directly, without service rollback.
+
+Note that for consistency with other packages a "halt" alias is provided,
+however it has no special significance. Note that the default action is to
+power down the system.
+.\"
+.SH OPTIONS
+.TP
+\fB\-r\fP
+Request a shutdown followed by restart. This is the default if executed as
+\fBreboot\fR.
+.TP
+\fB\-h\fP
+Shutdown and then halt the system (without powering down).
+.TP
+\fB\-p\fP
+Shutdown and then power down the system. This is the default unless executed
+as \fBreboot\fR.
+.TP
+\fB\-\-use\-passed\-cfd\fR
+Instead of attempting to open a socket connection to the service daemon,
+use a pre-opened connection that has been passed to the process from its parent
+via an open file descriptor. The file descriptor with the connection is identifed
+by the DINIT_CS_FD environment variable.
+.TP
+\fB\-\-system\fR
+Shut down directly, instead of by issuing a command to the service manager. Use of
+this option should be avoided, but it may allow performing a clean shutdown in case
+the service manager has stopped responding.
+
+The service manager may invoke \fBshutdown\fR with this option in order to perform
+system shutdown after it has rolled back services.
+.\"
+.SH SEE ALSO
+.\"
+\fBdinit\fR(8), \fBdinitctl\fR(8)
+.\"
+.SH AUTHOR
+Dinit, and this manual, were written by Davin McCall.
+$$$dnl
diff --git a/src/version.conf b/src/version.conf
new file mode 100644 (file)
index 0000000..0e2b5d2
--- /dev/null
@@ -0,0 +1,4 @@
+# Included from Makefiles.
+VERSION=0.5.2
+MONTH=June
+YEAR=2019