oweals/dinit.git
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.

5 years agomanpage: fix formatting glitch.
Davin McCall [Sun, 21 Oct 2018 14:35:43 +0000 (15:35 +0100)]
manpage: fix formatting glitch.

5 years agoAdd missing include (fixes build on musl systems)
Davin McCall [Sun, 21 Oct 2018 13:37:45 +0000 (14:37 +0100)]
Add missing include (fixes build on musl systems)

5 years agodocs: mention that dinitctl enable defaults to boot as dependent. v0.4.0
Davin McCall [Sat, 20 Oct 2018 14:38:40 +0000 (15:38 +0100)]
docs: mention that dinitctl enable defaults to boot as dependent.

5 years agodinit-util: include string header (FreeBSD build fix)
Davin McCall [Sat, 20 Oct 2018 14:26:18 +0000 (15:26 +0100)]
dinit-util: include string header (FreeBSD build fix)

5 years agodocs: use boot.d directory with example boot service
Davin McCall [Sat, 20 Oct 2018 14:20:55 +0000 (15:20 +0100)]
docs: use boot.d directory with example boot service

5 years agoUpdate .gitignore
Davin McCall [Sat, 20 Oct 2018 14:19:26 +0000 (15:19 +0100)]
Update .gitignore

5 years agodocs: prefer elogind to ConsoleKit2
Davin McCall [Sat, 20 Oct 2018 14:16:31 +0000 (15:16 +0100)]
docs: prefer elogind to ConsoleKit2

5 years agoUpdate version number, TODO.
Davin McCall [Sat, 20 Oct 2018 13:27:25 +0000 (14:27 +0100)]
Update version number, TODO.

5 years agoAdd NEWS file.
Davin McCall [Sat, 20 Oct 2018 13:17:19 +0000 (14:17 +0100)]
Add NEWS file.

5 years agoFix minor (non-bug) issues picked up by cppcheck.
Davin McCall [Sat, 20 Oct 2018 13:00:54 +0000 (14:00 +0100)]
Fix minor (non-bug) issues picked up by cppcheck.

5 years agoRe-name and fix documentation for ss_read().
Davin McCall [Sat, 20 Oct 2018 11:19:31 +0000 (12:19 +0100)]
Re-name and fix documentation for ss_read().

The function actually reads until the complete requested amount is read
(or it hits end-of-file or another error).

5 years agoservice description: make waits-for.d path relative to service file.
Davin McCall [Fri, 19 Oct 2018 22:00:41 +0000 (23:00 +0100)]
service description: make waits-for.d path relative to service file.

If the path specified by waits-for.d is not absolute, it will be
interpreted as relative to the directory containing the service
description file.

5 years agoAdd code style guide.
Davin McCall [Fri, 19 Oct 2018 08:48:54 +0000 (09:48 +0100)]
Add code style guide.

5 years agoMinor TODO updates.
Davin McCall [Thu, 18 Oct 2018 21:24:39 +0000 (22:24 +0100)]
Minor TODO updates.

5 years agoservice start_dep(): only bump acquire count if not already holding.
Davin McCall [Thu, 18 Oct 2018 20:33:22 +0000 (21:33 +0100)]
service start_dep(): only bump acquire count if not already holding.

5 years agodinitctl: enable: correct argument order for symlink
Davin McCall [Thu, 18 Oct 2018 20:17:24 +0000 (21:17 +0100)]
dinitctl: enable: correct argument order for symlink

Target, then link name, apparently.

5 years agodinitctl: correct logic for checking missing arguments.
Davin McCall [Thu, 18 Oct 2018 19:56:15 +0000 (20:56 +0100)]
dinitctl: correct logic for checking missing arguments.

Enable/disable commands can set 'to_service' without setting 'service';
check for this.

5 years agoAllow '.' in setting names (for "waits-for.d").
Davin McCall [Thu, 18 Oct 2018 19:44:57 +0000 (20:44 +0100)]
Allow '.' in setting names (for "waits-for.d").

5 years agoMinor build fixes for Linux/Glibc.
Davin McCall [Thu, 18 Oct 2018 19:30:34 +0000 (20:30 +0100)]
Minor build fixes for Linux/Glibc.

5 years agodinitctl man: add enable and disable command descriptions.
Davin McCall [Thu, 18 Oct 2018 17:59:33 +0000 (18:59 +0100)]
dinitctl man: add enable and disable command descriptions.

5 years agodinitctl: implement "disable" command.
Davin McCall [Thu, 18 Oct 2018 17:41:42 +0000 (18:41 +0100)]
dinitctl: implement "disable" command.

Opposite of "enable"; removes a dependency and unlinks the entry in
waits-for.d of the target service.

5 years agodinitctl: refactoring.
Davin McCall [Thu, 18 Oct 2018 09:34:06 +0000 (10:34 +0100)]
dinitctl: refactoring.

5 years agodinitctl: implement "enable" command.
Davin McCall [Thu, 18 Oct 2018 09:12:24 +0000 (10:12 +0100)]
dinitctl: implement "enable" command.

This is for persistently enabling a service. The enabled service is
added as a dependency of its target (default "boot") and an entry is
added to the target's waits-for.d directory (which must be specified
exactly once in its service description).

5 years agotests: add test for control protocol ENABLESERVICE command.
Davin McCall [Wed, 17 Oct 2018 16:33:46 +0000 (17:33 +0100)]
tests: add test for control protocol ENABLESERVICE command.

5 years agocontrol: add function to enable service.
Davin McCall [Tue, 16 Oct 2018 21:45:05 +0000 (22:45 +0100)]
control: add function to enable service.

This adds a dependency, and starts the dependent service if not already
started (and if the dependent is started/starting).

5 years agoFactor out service description loading to a separate header.
Davin McCall [Mon, 15 Oct 2018 17:57:52 +0000 (18:57 +0100)]
Factor out service description loading to a separate header.

This allows for reading service descriptions directly from dinitctl,
which is useful for planned "enable/disable service" functionality.

5 years agoReduce some source line lengths.
Davin McCall [Mon, 24 Sep 2018 17:50:11 +0000 (18:50 +0100)]
Reduce some source line lengths.

5 years agoMove service type id constants into service-constants.h
Davin McCall [Mon, 24 Sep 2018 17:30:24 +0000 (18:30 +0100)]
Move service type id constants into service-constants.h

5 years agodinitctl: reduce verbosity of help text, trim some lines.
Davin McCall [Mon, 24 Sep 2018 12:30:34 +0000 (13:30 +0100)]
dinitctl: reduce verbosity of help text, trim some lines.

5 years agodinitctl: add utility method to extract string from cpbuffer.
Davin McCall [Mon, 24 Sep 2018 12:23:49 +0000 (13:23 +0100)]
dinitctl: add utility method to extract string from cpbuffer.

5 years agocontrol: send current working dir in load mechanism reply packet.
Davin McCall [Fri, 21 Sep 2018 16:29:01 +0000 (17:29 +0100)]
control: send current working dir in load mechanism reply packet.

The load paths are relative to the current working directory, so the
client needs to know what it is to resolve the paths properly.

5 years agocpbuffer extract(): use integer arithmetic instead of char pointer.
Davin McCall [Tue, 18 Sep 2018 22:31:37 +0000 (23:31 +0100)]
cpbuffer extract(): use integer arithmetic instead of char pointer.

The method is designed to extract data to an arbitrary type, and while
char * should probably be safe to do that with, conversion to char * is
not specified in C++ as it is in C, and compilers are becoming more
aggressive.

5 years agocontrol: server side support for querying load paths.
Davin McCall [Tue, 18 Sep 2018 17:57:34 +0000 (18:57 +0100)]
control: server side support for querying load paths.

Support for querying the service loader mechanism (currently there is
only one) and its details (the paths from which it loads service
descriptions).

5 years agodirload_service_set; correctly record service dir allocation.
Davin McCall [Mon, 17 Sep 2018 17:32:12 +0000 (18:32 +0100)]
dirload_service_set; correctly record service dir allocation.

The service directory can be allocated statically or dynamically (in
which case it is "owned" by the service set). Correctly track it for the
single-directory constructor.

5 years agodinit: remove unused variable.
Davin McCall [Mon, 17 Sep 2018 09:43:54 +0000 (10:43 +0100)]
dinit: remove unused variable.

5 years agodinitctl: unload: issue a specialised message if service not loaded.
Davin McCall [Fri, 14 Sep 2018 20:21:47 +0000 (21:21 +0100)]
dinitctl: unload: issue a specialised message if service not loaded.

5 years agodinitctl: fix incorrect exit status if start/stop fails to load service.
Davin McCall [Fri, 14 Sep 2018 20:13:11 +0000 (21:13 +0100)]
dinitctl: fix incorrect exit status if start/stop fails to load service.

5 years agodinitctl: give an error message if unrecognized option/command given.
Davin McCall [Fri, 14 Sep 2018 20:12:02 +0000 (21:12 +0100)]
dinitctl: give an error message if unrecognized option/command given.

An unrecognized option was just exiting silently, and an unrecognized
command would print the help text. Now, print an appropriate error in
each case.

5 years agoAvoid multiple cout statements when printing help.
Davin McCall [Fri, 14 Sep 2018 19:11:21 +0000 (20:11 +0100)]
Avoid multiple cout statements when printing help.

Print help as one big string rather than by one-per-line cout with endl.

5 years agoUpdated bundled Dasynq to 1.1.5.
Davin McCall [Fri, 14 Sep 2018 15:54:01 +0000 (16:54 +0100)]
Updated bundled Dasynq to 1.1.5.

5 years agoRemove some default copy constructors and their unintended uses.
Davin McCall [Thu, 13 Sep 2018 18:56:27 +0000 (19:56 +0100)]
Remove some default copy constructors and their unintended uses.

5 years agoBuild docs: document fuzz testing for control protocol.
Davin McCall [Thu, 13 Sep 2018 18:20:53 +0000 (19:20 +0100)]
Build docs: document fuzz testing for control protocol.

5 years agoTests: use consistent output spacing and flush before running each test.
Davin McCall [Thu, 13 Sep 2018 18:13:56 +0000 (19:13 +0100)]
Tests: use consistent output spacing and flush before running each test.

5 years agoAvoid undefined char* arithmetic.
Davin McCall [Thu, 13 Sep 2018 18:04:47 +0000 (19:04 +0100)]
Avoid undefined char* arithmetic.

Use uintptr_t instead of char* for "unusual" pointer arithmetic.

5 years agoTests: add another test.
Davin McCall [Thu, 13 Sep 2018 15:55:51 +0000 (16:55 +0100)]
Tests: add another test.

Add a test that starting a service which has a waits-for dependency on
another service, currently stopping, causes that service to restart
after stopping.

5 years agoAdjust dependency auto-break logic.
Davin McCall [Thu, 13 Sep 2018 15:33:34 +0000 (16:33 +0100)]
Adjust dependency auto-break logic.

If a service stops, and has a soft dependency from another service,
don't break the dependency if the service is waiting_on this one - in
that case we want to restart.

5 years agoMinor header/signature adjustments.
Davin McCall [Thu, 13 Sep 2018 14:38:38 +0000 (15:38 +0100)]
Minor header/signature adjustments.

Add const to some method arguments.