Repository navigation
wip: new manpage docs #1092
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
wip: new manpage docs #1092
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,113 @@ | ||
| .Dd $Mdocdate$ | ||
| .Dt openrc-intro 7 | ||
| .Os | ||
|
|
||
| .Sh NAME | ||
| .Nm openrc-intro | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. File name does not match this name. |
||
| .Nd An introduction to openrc init scripts | ||
|
|
||
| .Sh SYNTAX | ||
|
|
||
| openrc init scripts are POSIX shell scripts, interpreted by | ||
| .Xr openrc-run 8 | ||
|
|
||
| .Sh DEFAULT FUNCTIONS | ||
| openrc requires that every service provides the | ||
| .Ic start Ns () , | ||
| .Ic stop Ns () , | ||
| and | ||
| .Ic status Ns () | ||
| commands. | ||
|
Comment on lines
+15
to
+20
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a misleading start if the next paragraph indicates that users shouldn't define custom When should these actually be defined by the user?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. that was meant to be covered by we could have it say |
||
|
|
||
| In order to simplify init scripts, openrc provides default implementations to | ||
| all required commands, configured via shell variables, thus most services then | ||
| are composed of only a couple variable assignments. | ||
|
|
||
| Do not define custom | ||
| .Ic start Ns () | ||
| or | ||
| .Ic stop Ns () | ||
| functions for managing daemons. | ||
|
|
||
| Any service that start a daemon must define | ||
| .Va command . | ||
| For a full list of all variables, refer to | ||
| .Xr openrc-run 8 . | ||
|
|
||
| .Sh _pre AND _post FUNCTIONS | ||
| In order to run preparation and checks, the init script can define pre-command | ||
| and post-command function for any command, by defining a function with said | ||
| command name, suffixed with _pre or _post. | ||
|
|
||
| If those functions return a non-0 exit status, openrc will not proceed with | ||
| executing the command proper, thus | ||
| .Ic start_pre Ns () | ||
| and | ||
| .Ic stop_pre Ns () | ||
| can be used to run precondition checks and disallowing the service to be | ||
| started or stopped should they fail. | ||
|
|
||
| .Sh CUSTOM COMMANDS | ||
| Custom commands can be declared and made available to users. | ||
|
|
||
| Define a function for the command, and include it in either | ||
| .Va extra_commands , | ||
| .Va extra_started_commands , | ||
| or | ||
| .Va extra_stopped_commands . | ||
|
|
||
| .Sh DEPENDENCIES | ||
| Dependencies across services are declared in the | ||
| .Ic depend Ns () | ||
| function, openrc will attempt to start any | ||
| .Ic need | ||
| or | ||
| .Ic want | ||
| service beforehand, and will stop/restart services when | ||
| .Ic need | ||
| services are stopped/restarted. | ||
|
|
||
| For a full list of dependency types, refer to | ||
| .Xr openrc-run 8 . | ||
|
|
||
| .Sh SUPERVISION | ||
| openrc provides | ||
| .Xr supervise-daemon 8 | ||
| to supervise services, it is recommended for init scripts to make use of it | ||
| in order to improve system reliability. | ||
|
|
||
| To use supervise-daemon, make sure the daemon does not fork, and stays in the | ||
| foreground, then set the | ||
| .Va supervisor | ||
| variable to | ||
| .Qq Dv supervise-daemon | ||
|
|
||
| .Sh EXAMPLE | ||
| .Bd -literal | ||
| #!/sbin/openrc-run | ||
|
|
||
| depend() { | ||
| need nya | ||
| } | ||
|
|
||
| supervisor=supervise-daemon | ||
| command=/bin/foo | ||
| command_user=foo:foo | ||
| extra_commands="checkconfig" | ||
|
|
||
| checkconfig() { | ||
| /bin/foo --check-config | ||
| } | ||
|
|
||
| start_pre() { | ||
| checkpath -o $command_user /run/foo | ||
|
|
||
| checkconfig | ||
| } | ||
| .Ed | ||
|
|
||
| .Sh SEE ALSO | ||
| .Xr openrc-run 8 | ||
|
|
||
| .Sh AUTHORS | ||
| .An navi Aq Mt navi@vlhl.dev | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| .Dd $Mdocdate$ | ||
| .Dt openrc-user-serivces 7 | ||
| .Os | ||
|
|
||
| .Sh NAME | ||
| .Nm User Services | ||
| .Nd Overview of user services for openrc | ||
|
|
||
| .Sh DESCRIPTION | ||
|
|
||
| The core of openrc does not require superuser permissions, | ||
| however historically some part of it assumed such permissions, | ||
| notably for the control directory and features such as cgroups. | ||
|
|
||
| .Sh ENVIRONMENT | ||
|
|
||
| For directories, | ||
| .Ev RC_PATH | ||
| and | ||
| .Ev RC_SVCDIR | ||
| were introduced. See | ||
| .Xr openrc-run 8 | ||
| for more details about them. | ||
|
|
||
| When | ||
| .Fl -user | ||
| is used, openrc prepends | ||
| .Pa ${XDG_CONFIG_HOME}/rc | ||
| to | ||
| .Ev RC_PATH , | ||
| as well as appending | ||
| .Pa /user | ||
| to all other entries, and sets | ||
| .Ev RC_SVCDIR | ||
| to | ||
| .Pa ${XDG_RUNTIME_DIR}/openrc | ||
|
|
||
| .Sh RUNLEVELS | ||
|
|
||
| .Ss boot | ||
|
|
||
| The | ||
| .Sx SYSTEM SERVICE | ||
| will start the boot runlevel for users, and wait for the runlevel change | ||
| to complete before marking itself as ready. | ||
|
|
||
| When combined with the | ||
| .Sx PAM | ||
| module, this guarantees that boot services are up before the user session | ||
| starts, additionally, any environment variables reexported by boot services | ||
| are made available to the new pam session. Useful for services like dbus and | ||
| .Ev DBUS_SESSION_BUS_ADDRESS . | ||
|
|
||
| .Ss default | ||
|
|
||
| After starting the boot runlevel, the default runlevel is started asynchronously. | ||
| The | ||
| .Sx PAM | ||
| module does not wait for default services to start before returning flow back to pam. | ||
|
|
||
| .Ss shutdown | ||
|
|
||
| When stopping, the | ||
| .Sx SYSTEM SERVICE | ||
| will switch to this runlevel, which stops services from boot and default. | ||
| Long running services must not be started in the shutdown runlevel. | ||
| System policies may enforce that all user processes are killed on last logout. | ||
|
|
||
| .Sh PAM | ||
| openrc ships | ||
| .Lb pam_openrc.so | ||
| for the purpose of starting and stopping services on session open and session close. | ||
|
|
||
| It does so by counting session and starting the system | ||
| .Dv user | ||
| service, multiplexed to the current user as | ||
| .Dv user.$USER . | ||
|
|
||
| .Sh SYSTEM SERVICE | ||
|
|
||
| The system service starts a new pam session for the target user, to get access to resources | ||
| like | ||
| .Ev XDG_RUNTIME_DIR | ||
| should it be made available via pam, e.g. with logind or pam_xdg. | ||
|
|
||
| then executes runlevels as specified in | ||
| .Sx RUNLEVELS . | ||
|
|
||
| .Sh BUGS | ||
|
|
||
| At the moment, the service cgroup options don't work for user services, as openrc | ||
| lacks the ability to delegate cgroups. | ||
|
|
||
| .Sh SEE ALSO | ||
|
|
||
| .Xr openrc-run 8 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mandoc will render these empty lines as empty lines, so the man page has lots of empty lines.
Use a line with
.instead, which yields the visual separation that you want in the source without affecting how the page is rendered.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, mandb ignores them (which i was using to test) but mandoc proper doesn't, wonderful
will fix