{"id":25983431,"url":"https://github.com/chimera-linux/dinit-dbus","last_synced_at":"2025-03-05T10:03:13.308Z","repository":{"id":205210865,"uuid":"713657632","full_name":"chimera-linux/dinit-dbus","owner":"chimera-linux","description":"D-Bus integration for dinit","archived":false,"fork":false,"pushed_at":"2023-11-04T00:03:48.000Z","size":19,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2023-11-04T04:24:18.176Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chimera-linux.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-11-03T01:08:07.000Z","updated_at":"2023-11-03T07:40:22.000Z","dependencies_parsed_at":null,"dependency_job_id":"9b0bec16-5899-4e9c-90f0-3bf1dce2ee9f","html_url":"https://github.com/chimera-linux/dinit-dbus","commit_stats":null,"previous_names":["chimera-linux/dinit-dbus"],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chimera-linux%2Fdinit-dbus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chimera-linux%2Fdinit-dbus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chimera-linux%2Fdinit-dbus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chimera-linux%2Fdinit-dbus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chimera-linux","download_url":"https://codeload.github.com/chimera-linux/dinit-dbus/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242005805,"owners_count":20056434,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-05T10:02:07.360Z","updated_at":"2025-03-05T10:03:13.298Z","avatar_url":"https://github.com/chimera-linux.png","language":"C++","funding_links":[],"categories":["D-Bus"],"sub_categories":[],"readme":"# dinit-dbus\n\nThis is a D-Bus interface to dinit (https://github.com/davmac314/dinit).\n\nIt is built upon libdinitctl (https://github.com/chimera-linux/libdinitctl).\n\nIt is exposed by a daemon called `dinit-dbus`.\n\nThe daemon is meant to run as a dinit service. Such service should specify:\n\n```\nready-notification = pipevar:DINIT_DBUS_READY_FD\noptions = pass-cs-fd\n```\n\nWhen executed, the service will use the available file descriptor for control\nand will signal readiness at an appropriate time.\n\nYou can also specify the file descriptor manually (`-f FD`) or specify the\nsocket path (`-S /path/to/socket`).\n\n## API\n\nThe API generally mirrors the libdinitctl API. One difference is that\nsince the D-Bus API uses global objects available to any caller, all\nactions work by service name instead of using handles. Handles are\ninstead set up internally and temporarily for the lifetime of an event.\n\nThis also means every method that takes a service name may raise the\nsame errors service loading would raise in the C API.\n\nThe following interfaces are available:\n\n* `org.chimera.dinit.Manager`\n* `org.chimera.dinit.Activator`\n\nThe `Manager` interface is implemented by the object `/org/chimera/dinit`,\nwhich is present on the bus from the start.\n\nIt implements the following methods:\n\n* `UnloadService(in s name, in b reload)`\n* `StartService(in s name, in b pin, out u eventid)`\n* `StopService(in s name, in b pin, in b restart, in b gentle, out u eventid)`\n* `WakeService(in s name, in b pin, out u eventid)`\n* `ReleaseService(in s name, in b pin, out u eventid)`\n* `UnpinService(in s name)`\n* `AddRemoveServiceDependency(in s from_name, in s to_name, in s type, in b remove, in b enable)`\n* `GetServiceDirectory(in s name, out s dir)`\n* `GetServiceLog(in s name, in b clear, out s log)`\n* `GetServiceStatus(in s name, out (ssssa{sb}uii) status)`\n* `SetServiceTrigger(in s name, in b trigger)`\n* `SignalService(in s name, in s signal)`\n* `ListServices(out a(sssssa{sb}ui) list)`\n* `SetEnvironment(in as env_vars)`\n* `GetAllEnvironment(out as list)`\n* `Shutdown(in s type)`\n* `QueryServiceDirs(out as list)`\n* `CreateEphemeralService(in s name, in s contents)`\n* `RemoveEphemeralService(in s name)`\n\nNotably, the `SetEnvironment` differs from `dinitctl_setenv` in that it can\ntake multiple environment variables (it will chain multiple protocol messages)\nand that it requires the input strings to always be in the format `NAME=VALUE`\nto set the variables, with just `NAME` unsetting them (because the invocation\nhappens from a different process than the caller's). A mix of setting and\nunsetting is permitted.\nThe first failed (un)setenv will raise the D-Bus error, i.e. everything up\nuntil the failed one will be (un)set.\n\nAnd the following signals:\n\n* `ServiceEvent(u eventid, s event, (ssssa{sb}uii) status)`\n* `EnvironmentEvent(s env, b overridden)`\n\nThe `Activator` interface provides two signals:\n\n* `ActivationRequest(s name)`\n* `ActivationFailure(s name, s error, s message)`\n\nThe daemon will subscribe to the `ActivationRequest` signal on\n`/org/freedesktop/DBus` with destination `org.chimera.dinit`, interface\n`org.chimera.dinit.Activator`. The bus controller may then emit it, which will\nmake `dinit-dbus` activate the service. Its sole argument is the service name.\n\nIn case of activation failure, the `ActivationFailure` signal will be emitted\non the `/org/chimera/dinit` object. It takes the service name, the error name,\nand the error message. The D-Bus controller may subscribe to it and emit the\nappropriate error as needed.\n\nThe `dinitctl_error` enum is mapped to D-Bus errors. The following errors\nare provided:\n\n* `org.chimera.dinit.Error.Error`\n* `org.chimera.dinit.Error.ShuttingDown`\n* `org.chimera.dinit.Error.ServiceMissing`\n* `org.chimera.dinit.Error.ServiceDesc`\n* `org.chimera.dinit.Error.ServiceLoad`\n* `org.chimera.dinit.Error.ServiceNoPid`\n* `org.chimera.dinit.Error.ServiceBadSignal`\n* `org.chimera.dinit.Error.ServiceSignalFailed`\n* `org.chimera.dinit.Error.ServicePinned`\n* `org.chimera.dinit.Error.ServiceAlready`\n* `org.chimera.dinit.Error.ServiceDependents`\n\nNon-recoverable errors from the C API will result in `dinit-dbus` shutting\ndown and kicking out any clients.\n\nOther enums translate to strings. Passing an invalid string will result in\nthe `org.freedesktop.DBus.Error.InvalidArgs` error. In general, conditions\nthat would raise `EINVAL` in C will also result in that error.\n\nFor service state:\n\n* `stopped`\n* `starting`\n* `started`\n* `stopping`\n\nFor dependency type:\n\n* `regular`\n* `waits_for`\n* `milestone`\n\nFor stop rason:\n\n* `normal`\n* `dep_restart`\n* `dep_failed`\n* `failed`\n* `exec_failed`\n* `timeout`\n* `terminated`\n\nFor execution stage:\n\n* `fds`\n* `env`\n* `readiness`\n* `activation_socket`\n* `control_socket`\n* `chdir`\n* `stdio`\n* `cgroup`\n* `rlimits`\n* `uid_gid`\n\nFor service event type:\n\n* `stated`\n* `stopped`\n* `start_failed`\n* `start_canceled`\n* `stop_canceled`\n\nFor shutdown type:\n\n* `remain`\n* `halt`\n* `poweroff`\n* `reboot`\n\nService flags are provided as a dictionary with string keys and boolean values.\nCurrently available keys are:\n\n* `waiting_for_console`\n* `has_console`\n* `was_start_skipped`\n* `is_marked_active`\n* `has_pid`\n\nThe service status is a struct with the signature `(ssssa{sb}uii)`. The\nfields here are:\n\n* service state\n* service target state\n* service stop reason\n* service exec stage\n* flags dict\n* PID\n* exit code\n* and exit status\n\nFor `ListServices`, the output is an array of structs. This array matches\nthe the status struct, except it also has an additional member (service name)\nat the beginning.\n\n## Usage from command line\n\nYou can use something like this:\n\n```\n$ dbus-send --dest=org.chimera.dinit --print-reply --type=method_call /org/chimera/dinit org.chimera.dinit.Manager.GetServiceStatus string:dbus\n```\n\nand so on. You can also subscribe to signals with `dbus-monitor`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchimera-linux%2Fdinit-dbus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchimera-linux%2Fdinit-dbus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchimera-linux%2Fdinit-dbus/lists"}