oweals/dinit.git
4 years agoUpdate NEWS and version. r0.5.2 v0.5.2
Davin McCall [Sat, 29 Jun 2019 05:46:28 +0000 (15:46 +1000)]
Update NEWS and version.

4 years agoOnly move fds from force_notify_fd if it is set!
Davin McCall [Sat, 29 Jun 2019 05:34:07 +0000 (15:34 +1000)]
Only move fds from force_notify_fd if it is set!

4 years agoShuffle file descriptors as necessary to avoid clash with notify fd.
Davin McCall [Sat, 29 Jun 2019 05:04:21 +0000 (15:04 +1000)]
Shuffle file descriptors as necessary to avoid clash with notify fd.

Cherry-picked from development.

Conflicts:
src/run-child-proc.cc

4 years agoRe-create control socket file node if it disappears.
Davin McCall [Sat, 29 Jun 2019 03:41:38 +0000 (13:41 +1000)]
Re-create control socket file node if it disappears.

In case something is mounted over /dev (or wherever the control socket
lives) it will become inaccessible. When a starts-rwfs service starts,
check the socket node still exists and if not, close the socket and
re-open.

Cherry-picked from development branch.

4 years agoFix use of old settings in sample config, see #16.
Davin McCall [Fri, 28 Jun 2019 09:58:35 +0000 (19:58 +1000)]
Fix use of old settings in sample config, see #16.

Cherry-picked from development branch.

4 years agoFix typo in function name (workding -> working)
Davin McCall [Sat, 22 Jun 2019 03:03:51 +0000 (04:03 +0100)]
Fix typo in function name (workding -> working)

Cherry-picked from development branch.

4 years agoProcess service state queues after readiness via fd.
Davin McCall [Sun, 2 Jun 2019 10:09:46 +0000 (20:09 +1000)]
Process service state queues after readiness via fd.

Cherry-picked from development branch.

4 years agoDon't abuse std::find to find end of special message.
Davin McCall [Sun, 2 Jun 2019 09:28:57 +0000 (19:28 +1000)]
Don't abuse std::find to find end of special message.

Cherry-picked from development branch.

4 years agoAdd CONTRIBUTORS. r0.5.1 v0.5.1
Edd Barrett [Thu, 30 May 2019 10:41:13 +0000 (11:41 +0100)]
Add CONTRIBUTORS.

4 years agoAdd the getting started guide.
Edd Barrett [Sat, 25 May 2019 13:26:50 +0000 (14:26 +0100)]
Add the getting started guide.

4 years agoImprove "stop" documentation, bring in line with implementation.
Davin McCall [Wed, 29 May 2019 10:16:18 +0000 (20:16 +1000)]
Improve "stop" documentation, bring in line with implementation.

4 years agoBreak holds from soft dependents if a service is manually stopped.
Davin McCall [Wed, 29 May 2019 08:56:19 +0000 (18:56 +1000)]
Break holds from soft dependents if a service is manually stopped.

If all dependents are soft (waits-for or soft) then break their holds on
a service that is manually stopped. This prevents the service from
immediately re-starting, which would be unexpected behaviour.

4 years agoRemove unused function.
Davin McCall [Tue, 28 May 2019 11:01:09 +0000 (21:01 +1000)]
Remove unused function.

4 years agoFix restart of dependency services not explicitly started.
Davin McCall [Tue, 28 May 2019 10:11:48 +0000 (20:11 +1000)]
Fix restart of dependency services not explicitly started.

4 years agoAdd test for restart of a waits-for dependency.
Davin McCall [Tue, 28 May 2019 09:17:09 +0000 (19:17 +1000)]
Add test for restart of a waits-for dependency.

The dependent is not explicitly started, but should restart due to the
dependency (rather than breaking the dependency) because it has been set
to auto-restart.

4 years agoTests: don't call timer_expiry directly.
Davin McCall [Sun, 26 May 2019 04:37:31 +0000 (14:37 +1000)]
Tests: don't call timer_expiry directly.

Advance the current simulated time and expire timers if they are active,
rather than calling the timer expiry directly (which makes the
assumption that the timer is active).

4 years agoFix time-out-during-start test.
Davin McCall [Sun, 26 May 2019 04:09:43 +0000 (14:09 +1000)]
Fix time-out-during-start test.

4 years agoClear the stop timer if scripted start is interrupted.
Davin McCall [Sun, 26 May 2019 04:09:10 +0000 (14:09 +1000)]
Clear the stop timer if scripted start is interrupted.

4 years agodinitctl: fix display of termination signal
Davin McCall [Sat, 25 May 2019 23:38:12 +0000 (09:38 +1000)]
dinitctl: fix display of termination signal

4 years agoFix restart after unexpected termination.
Davin McCall [Sat, 25 May 2019 14:56:12 +0000 (00:56 +1000)]
Fix restart after unexpected termination.

4 years agoAdd test for restart after unexpected termination.
Davin McCall [Sat, 25 May 2019 14:55:51 +0000 (00:55 +1000)]
Add test for restart after unexpected termination.

4 years agoAdd cross-compilation support.
Davin McCall [Sat, 25 May 2019 11:25:05 +0000 (21:25 +1000)]
Add cross-compilation support.

I.e. add HOSTCXX etc make variables, and use the host compiler when
compiling mconfig-gen.

4 years agomake install: use force when creating links
Davin McCall [Sat, 25 May 2019 08:29:47 +0000 (18:29 +1000)]
make install: use force when creating links

4 years agoFix waiting for console input.
Davin McCall [Sat, 25 May 2019 07:15:20 +0000 (17:15 +1000)]
Fix waiting for console input.

4 years agoTry to fix case where we can't getpgid() treating pid == pgid.
Davin McCall [Fri, 24 May 2019 10:54:02 +0000 (20:54 +1000)]
Try to fix case where we can't getpgid() treating pid == pgid.

The logic behind this is: if we can't use getpgid(), it's because the
process is in a different session. If that's the case, it must be a
process group leader with pgid == pid.

4 years agolog about not being able to get process group with INFO not WARN.
Davin McCall [Fri, 24 May 2019 08:59:44 +0000 (18:59 +1000)]
log about not being able to get process group with INFO not WARN.

4 years agoFix log levels (swap console/main log).
Davin McCall [Fri, 24 May 2019 08:58:50 +0000 (18:58 +1000)]
Fix log levels (swap console/main log).

The console should be WARN, main log should be INFO, not the other way
around. Don't want too much spurious stuff going out to the console.

4 years agoAdd KILL support to term-signal setting.
Davin McCall [Thu, 23 May 2019 21:13:27 +0000 (07:13 +1000)]
Add KILL support to term-signal setting.

Also have renamed termsignal to term-signal for consistency, but the old
name remains supported.

4 years agoBump version to 0.5.1.
Davin McCall [Thu, 23 May 2019 12:35:44 +0000 (22:35 +1000)]
Bump version to 0.5.1.

4 years agodinitctl: handle service dir with absolute path in enable/disable.
Davin McCall [Thu, 23 May 2019 11:20:39 +0000 (21:20 +1000)]
dinitctl: handle service dir with absolute path in enable/disable.

4 years agoUpdate bundled Dasynq to latest (1.1.6).
Davin McCall [Thu, 23 May 2019 10:39:28 +0000 (20:39 +1000)]
Update bundled Dasynq to latest (1.1.6).

Fixes critical issue on OpenBSD.

4 years agoJust signal the process if we can't get the process group.
Davin McCall [Wed, 22 May 2019 10:33:15 +0000 (20:33 +1000)]
Just signal the process if we can't get the process group.

On OpenBSD (and possibly others) we can't get the process group of a
process that's in a different session, so fall back to signalling the
process.

4 years agoUse SYSCONTROLSOCKET for socket path in dinitctl/shutdown.
Davin McCall [Wed, 22 May 2019 10:22:45 +0000 (20:22 +1000)]
Use SYSCONTROLSOCKET for socket path in dinitctl/shutdown.

Patches from vext01.

4 years agoAnother minor fix to man page.
Davin McCall [Wed, 22 May 2019 10:13:31 +0000 (20:13 +1000)]
Another minor fix to man page.

4 years agoDocs: mention "boot" service in Readme, etc.
Davin McCall [Tue, 21 May 2019 21:43:30 +0000 (07:43 +1000)]
Docs: mention "boot" service in Readme, etc.

4 years agoDon't discard buffer unless >1 second has elapse since console release.
Davin McCall [Fri, 10 May 2019 13:37:33 +0000 (23:37 +1000)]
Don't discard buffer unless >1 second has elapse since console release.

If the log subsystem releases the console, the log buffer is normally
discarded when it is re-acquired (so that stale messages are not then
displayed). This change allows for a 1 second window, so that
short-running foreground jobs don't prevent log messages being seen.

4 years agoDon't fail service on failure to write utmp entry.
Davin McCall [Fri, 10 May 2019 10:53:27 +0000 (20:53 +1000)]
Don't fail service on failure to write utmp entry.

This can simply be the result of the utmp database not existing on the
system.

4 years agoexamples: create utmp file on boot.
Davin McCall [Fri, 10 May 2019 10:13:19 +0000 (20:13 +1000)]
examples: create utmp file on boot.

(Revert earlier change).

4 years agoAllow ctrl+alt+del when waiting for user response.
Davin McCall [Fri, 10 May 2019 10:08:50 +0000 (20:08 +1000)]
Allow ctrl+alt+del when waiting for user response.

When boot fails (i.e. all services stop without shutdown issued) user is
prompted before re-starting the boot service. By allowing signal
processing, they can use ctrl+alt+del (on Linux) to reboot instead.

4 years agoRename "event_loop" label to avoid name clash.
Davin McCall [Tue, 7 May 2019 11:59:08 +0000 (21:59 +1000)]
Rename "event_loop" label to avoid name clash.

4 years agoContinue processing signals while waiting for user to ack boot restart.
Davin McCall [Tue, 7 May 2019 11:57:43 +0000 (21:57 +1000)]
Continue processing signals while waiting for user to ack boot restart.

When services stop without a shutdown being requested (for system init)
the user is prompted to confirm restart of boot sequence. Give them a
chance to instead reboot (via ctrl+alt+del on Linux).

4 years agoFix typo.
Davin McCall [Sun, 5 May 2019 04:35:10 +0000 (14:35 +1000)]
Fix typo.

4 years agoImplement minor suggestions from cppcheck report.
Davin McCall [Sun, 5 May 2019 04:22:40 +0000 (14:22 +1000)]
Implement minor suggestions from cppcheck report.

4 years agoDon't need to clear utmp in rcboot.sh; dinit now does it.
Davin McCall [Fri, 3 May 2019 10:25:15 +0000 (20:25 +1000)]
Don't need to clear utmp in rcboot.sh; dinit now does it.

4 years agoDocument all mconfig options.
Davin McCall [Fri, 3 May 2019 10:22:55 +0000 (20:22 +1000)]
Document all mconfig options.

4 years agoAdd support for specifying USE_UTMPX in mconfig.
Davin McCall [Fri, 3 May 2019 10:22:44 +0000 (20:22 +1000)]
Add support for specifying USE_UTMPX in mconfig.

4 years agoSlight re-work of Musl utmp support detection.
Davin McCall [Fri, 3 May 2019 10:00:02 +0000 (20:00 +1000)]
Slight re-work of Musl utmp support detection.

4 years agoFix for compilation with Musl. v0.5.0
Davin McCall [Thu, 2 May 2019 11:41:15 +0000 (21:41 +1000)]
Fix for compilation with Musl.

Musl only has stub implementations of utmp* functions, and doesn't
define _PATH_UTMPX nor _PATH_WTMPX.

4 years agoPrompt to run tests or install after build.
Davin McCall [Thu, 2 May 2019 10:47:02 +0000 (20:47 +1000)]
Prompt to run tests or install after build.

4 years agoAdd mconfig to gitignore.
Davin McCall [Thu, 2 May 2019 10:43:45 +0000 (20:43 +1000)]
Add mconfig to gitignore.

4 years agoUpdate TODO.
Davin McCall [Thu, 2 May 2019 10:42:46 +0000 (20:42 +1000)]
Update TODO.

4 years agoMinor README fixes.
Davin McCall [Thu, 2 May 2019 10:39:41 +0000 (20:39 +1000)]
Minor README fixes.

4 years agoChoose appropriate build configuration automatically.
Davin McCall [Thu, 2 May 2019 10:39:20 +0000 (20:39 +1000)]
Choose appropriate build configuration automatically.

This could help prevent certain users, who do not read/follow the build
instructions, from becoming vexed.

4 years agoBump version to 0.5.0.
Davin McCall [Wed, 1 May 2019 21:40:49 +0000 (07:40 +1000)]
Bump version to 0.5.0.

4 years agoMinor improvements to dinit manpage.
Davin McCall [Wed, 1 May 2019 21:06:31 +0000 (07:06 +1000)]
Minor improvements to dinit manpage.

4 years agoAdd note that inittab-id/-line have no effect if utmp not supported.
Davin McCall [Wed, 1 May 2019 13:13:02 +0000 (23:13 +1000)]
Add note that inittab-id/-line have no effect if utmp not supported.

4 years agoAvoid boot loop on all-service failure.
Davin McCall [Wed, 1 May 2019 12:31:59 +0000 (22:31 +1000)]
Avoid boot loop on all-service failure.

If no shutdown has been issued but all services stop, prompt user before
re-starting boot sequence.

4 years agoInclude inittab-id/-line in example tty service descriptions.
Davin McCall [Tue, 30 Apr 2019 10:30:59 +0000 (20:30 +1000)]
Include inittab-id/-line in example tty service descriptions.

4 years agoGuard use of inittab_id/_line with #if USE_UTMPX.
Davin McCall [Tue, 30 Apr 2019 10:28:07 +0000 (20:28 +1000)]
Guard use of inittab_id/_line with #if USE_UTMPX.

4 years agoDocument inittab-id and inittab-line service settings.
Davin McCall [Sun, 28 Apr 2019 10:19:17 +0000 (20:19 +1000)]
Document inittab-id and inittab-line service settings.

4 years agoClear utmp database before logging boot.
Davin McCall [Sun, 28 Apr 2019 06:40:38 +0000 (16:40 +1000)]
Clear utmp database before logging boot.

5 years agoUpdate TODO.
Davin McCall [Tue, 5 Mar 2019 02:59:36 +0000 (02:59 +0000)]
Update TODO.

5 years agoAdd full utmp (utmpx) support.
Davin McCall [Mon, 26 Nov 2018 22:11:46 +0000 (22:11 +0000)]
Add full utmp (utmpx) support.

5 years agoAdd initial support for logging boot time to wtmp database.
Davin McCall [Thu, 22 Nov 2018 15:40:13 +0000 (15:40 +0000)]
Add initial support for logging boot time to wtmp database.

5 years agoFix case of process termination before readiness notification.
Davin McCall [Fri, 23 Nov 2018 23:00:00 +0000 (23:00 +0000)]
Fix case of process termination before readiness notification.

Adds a test.

5 years agocontrol: remove unused "rollback complete" reply.
Davin McCall [Tue, 20 Nov 2018 18:32:55 +0000 (18:32 +0000)]
control: remove unused "rollback complete" reply.

The connection should close before the reply could be sent, so don't
even pretend that it will be sent.

5 years agoExample dbusd: use readiness notification; process instead of bgprocess.
Davin McCall [Sat, 17 Nov 2018 11:10:28 +0000 (11:10 +0000)]
Example dbusd: use readiness notification; process instead of bgprocess.

5 years agoFix check of executable name used for shutdown.
Davin McCall [Sat, 17 Nov 2018 09:58:22 +0000 (09:58 +0000)]
Fix check of executable name used for shutdown.

5 years agoPass correct end of readiness notification pipe to subprocess.
Davin McCall [Sat, 17 Nov 2018 09:56:33 +0000 (09:56 +0000)]
Pass correct end of readiness notification pipe to subprocess.

5 years agoFix "make install".
Davin McCall [Sat, 17 Nov 2018 00:38:46 +0000 (00:38 +0000)]
Fix "make install".

Somehow, used the wrong slashes...

5 years agoAdd "ready-notification" service option.
Davin McCall [Sat, 17 Nov 2018 00:35:13 +0000 (00:35 +0000)]
Add "ready-notification" service option.

This allows either of the two notification methods - write to a specific
fd or to an fd identified by an environment variable.

5 years agoTests: add test for readiness notification via pipe.
Davin McCall [Fri, 16 Nov 2018 18:30:41 +0000 (18:30 +0000)]
Tests: add test for readiness notification via pipe.

5 years agoBackend support for S6-style readiness notification.
Davin McCall [Fri, 16 Nov 2018 10:31:38 +0000 (10:31 +0000)]
Backend support for S6-style readiness notification.

No support in service configuration yet.

5 years agoShorten (wrap) some too-long lines.
Davin McCall [Fri, 9 Nov 2018 21:23:17 +0000 (21:23 +0000)]
Shorten (wrap) some too-long lines.

5 years agoAvoid 2nd call to get current time when starting process.
Davin McCall [Fri, 9 Nov 2018 21:05:46 +0000 (21:05 +0000)]
Avoid 2nd call to get current time when starting process.

5 years agoRefactoring: move process-service specific classes to process-service.h
Davin McCall [Fri, 9 Nov 2018 18:29:39 +0000 (18:29 +0000)]
Refactoring: move process-service specific classes to process-service.h

5 years agoWrap too-long comment lines.
Davin McCall [Fri, 9 Nov 2018 10:20:42 +0000 (10:20 +0000)]
Wrap too-long comment lines.

5 years agoFix typo in DESIGN document.
Davin McCall [Wed, 7 Nov 2018 09:37:21 +0000 (09:37 +0000)]
Fix typo in DESIGN document.

5 years agoMakefile: fix parallel build (issue #9)
Davin McCall [Tue, 6 Nov 2018 12:36:29 +0000 (12:36 +0000)]
Makefile: fix parallel build (issue #9)

5 years agoUpdate TODO (one task done).
Davin McCall [Tue, 6 Nov 2018 11:34:15 +0000 (11:34 +0000)]
Update TODO (one task done).

5 years agoInstall halt and reboot as links to shutdown.
Davin McCall [Tue, 6 Nov 2018 11:32:32 +0000 (11:32 +0000)]
Install halt and reboot as links to shutdown.

Until now, halt and reboot were shell scripts that called shutdown.

5 years agoshutdown: clean up error handling.
Davin McCall [Mon, 5 Nov 2018 22:01:26 +0000 (22:01 +0000)]
shutdown: clean up error handling.

5 years agoshutdown: use argv 0 to determine default action.
Davin McCall [Mon, 5 Nov 2018 11:05:47 +0000 (11:05 +0000)]
shutdown: use argv 0 to determine default action.

If called as "reboot", default action is to reboot, otherwise to halt
and power down.

5 years agoAdd man page for shutdown et al.
Davin McCall [Fri, 2 Nov 2018 10:39:48 +0000 (10:39 +0000)]
Add man page for shutdown et al.

5 years agoMinor edits to dinit-service man page.
Davin McCall [Tue, 30 Oct 2018 19:03:27 +0000 (19:03 +0000)]
Minor edits to dinit-service man page.

5 years agoImplement a "shares-console" option for non-exclusive console access.
Davin McCall [Tue, 30 Oct 2018 19:01:02 +0000 (19:01 +0000)]
Implement a "shares-console" option for non-exclusive console access.

This could be useful for the "single" (single-user) service, so that
runs-on-console services can be started from it.

5 years agoImplement a "chain-to" service property.
Davin McCall [Mon, 29 Oct 2018 19:02:59 +0000 (19:02 +0000)]
Implement a "chain-to" service property.

This specifies that if a service completes, another service should be
started (specified by name and resolved at the time it is needed, not
beforehand).

This has applications for recovery ("single-user mode") services, and
for multi-stage booting where service descriptions are on a separate
filesystem which is mounted by a service in an initial stage.

5 years agoman page: minor additions/edits.
Davin McCall [Sat, 27 Oct 2018 15:24:45 +0000 (16:24 +0100)]
man page: minor additions/edits.

5 years agoLinux: only filter "auto" from command line if running as pid 1.
Davin McCall [Sat, 27 Oct 2018 15:09:50 +0000 (16:09 +0100)]
Linux: only filter "auto" from command line if running as pid 1.

5 years agoImprove comments / fix excessively long lines.
Davin McCall [Mon, 29 Oct 2018 12:17:51 +0000 (12:17 +0000)]
Improve comments / fix excessively long lines.

5 years agodinit man page: describe general operation.
Davin McCall [Sat, 27 Oct 2018 14:57:54 +0000 (15:57 +0100)]
dinit man page: describe general operation.

5 years agoAdd -u/--user to force running as a user service manager.
Davin McCall [Sat, 27 Oct 2018 13:33:31 +0000 (14:33 +0100)]
Add -u/--user to force running as a user service manager.

Since running as root now runs as a system service manager by default,
provide an option not to do so.

5 years agoFix indentation.
Davin McCall [Sat, 27 Oct 2018 13:09:33 +0000 (14:09 +0100)]
Fix indentation.

5 years agoSet control_socket_open false when closing the socket.
Davin McCall [Fri, 26 Oct 2018 09:25:07 +0000 (10:25 +0100)]
Set control_socket_open false when closing the socket.

If we booted to single-user mode, we close the socket once it exits, so
we need to open it again. Leaving control_socket_open true means that we
don't do that, so set it false.

5 years agoAdd a few comments.
Davin McCall [Fri, 26 Oct 2018 09:23:41 +0000 (10:23 +0100)]
Add a few comments.

5 years agoMinor style fix.
Davin McCall [Fri, 26 Oct 2018 09:15:06 +0000 (10:15 +0100)]
Minor style fix.

5 years agoComparison: overhaul.
Davin McCall [Sun, 21 Oct 2018 22:47:34 +0000 (23:47 +0100)]
Comparison: overhaul.

5 years agoDo not try to manage system (shutdown, reboot) if not running as PID 1.
Davin McCall [Sun, 21 Oct 2018 20:58:10 +0000 (21:58 +0100)]
Do not try to manage system (shutdown, reboot) if not running as PID 1.

If not PID 1, assume system management is being taken care of by a
separate primary init.

5 years agoBUILD: minor update and rename to BUILD.txt.
Davin McCall [Sun, 21 Oct 2018 16:51:08 +0000 (17:51 +0100)]
BUILD: minor update and rename to BUILD.txt.

The rename is to prevent Github from rendering the file with syntax
highlighting, urgh.

5 years agoman page: add notes on character set.
Davin McCall [Sun, 21 Oct 2018 14:53:06 +0000 (15:53 +0100)]
man page: add notes on character set.