aboutsummaryrefslogtreecommitdiff
path: root/src/rc-service
diff options
context:
space:
mode:
authorAnna (navi) Figueiredo Gomes <navi@vlhl.dev>2023-03-14 19:03:52 -0300
committerAnna (navi) Figueiredo Gomes <navi@vlhl.dev>2023-10-19 10:56:54 +0200
commit9efa44579fd1f60a4c9ace264bb0b968ccb0f7ea (patch)
tree71f6d00e0fe41ae3ac338c6dba21c75f7cb74528 /src/rc-service
parentb80971ce08dd080529efaf694afc67846e0748b8 (diff)
openrc: Add support for user services.
Modifies many functions where filesystem paths were hardcoded. In non-user-services mode, they still are. In user-services mode, they are allocated, since XDG_ dirs are to be set via environment variables. Signed-off-by: Anna (navi) Figueiredo Gomes <navi@vlhl.dev>
Diffstat (limited to 'src/rc-service')
-rw-r--r--src/rc-service/meson.build2
-rw-r--r--src/rc-service/rc-service.c16
2 files changed, 15 insertions, 3 deletions
diff --git a/src/rc-service/meson.build b/src/rc-service/meson.build
index 3a109d8e..543daf45 100644
--- a/src/rc-service/meson.build
+++ b/src/rc-service/meson.build
@@ -1,6 +1,6 @@
executable('rc-service',
['rc-service.c', misc_c, usage_c, version_h],
- c_args : cc_branding_flags,
+ c_args : [cc_branding_flags, cc_user_services_flags],
link_with: [libeinfo, librc],
include_directories: [incdir, einfo_incdir, rc_incdir],
install: true,
diff --git a/src/rc-service/rc-service.c b/src/rc-service/rc-service.c
index 3d2eb730..5127e75f 100644
--- a/src/rc-service/rc-service.c
+++ b/src/rc-service/rc-service.c
@@ -31,7 +31,11 @@
const char *applet = NULL;
const char *extraopts = NULL;
-const char getoptstring[] = "cdDe:ilr:INsSZ" getoptstring_COMMON;
+const char getoptstring[] = "cdDe:ilr:INsSZ" getoptstring_COMMON
+#ifdef RC_USER_SERVICES
+getoptstring_USER_SERVICES
+#endif
+;
const struct option longopts[] = {
{ "debug", 0, NULL, 'd' },
{ "nodeps", 0, NULL, 'D' },
@@ -45,6 +49,9 @@ const struct option longopts[] = {
{ "list", 0, NULL, 'l' },
{ "resolve", 1, NULL, 'r' },
{ "dry-run", 0, NULL, 'Z' },
+#ifdef RC_USER_SERVICES
+ longopts_USER_SERVICES
+#endif
longopts_COMMON
};
const char * const longopts_help[] = {
@@ -60,6 +67,9 @@ const char * const longopts_help[] = {
"list all available services",
"resolve the service name to an init script",
"dry run (show what would happen)",
+#ifdef RC_USER_SERVICES
+ longopts_help_USER_SERVICES
+#endif
longopts_help_COMMON
};
const char *usagestring = "" \
@@ -141,7 +151,9 @@ int main(int argc, char **argv)
case 'Z':
setenv("IN_DRYRUN", "yes", 1);
break;
-
+#ifdef RC_USER_SERVICES
+ case_RC_USER_SERVICES
+#endif
case_RC_COMMON_GETOPT
}
}