mirror of
https://github.com/troglobit/finit.git
synced 2026-11-10 16:31:21 +00:00
Skip registering service when if:!name matches a named svc_t
The delayed matcehd works when all run/task/services provide their own
unique identity, but for replacements this is sometimes not the case.
Example from system/10-hotplug.conf.in:
run nowarn conflict:udevd,mdev cgroup.init name:coldplug <service/mdevd/ready> \
[S] mdevd-coldplug -- Cold plugging system
vs
run nowarn conflict:udevd,mdevd cgroup.init name:coldplug if:!mdevd <service/mdev/running> \
[S] @pkglibexecdir@/coldplug -- Cold plugging system
Here they both provide the <run/coldplug/*> conditions, and if the first
is loaded, because we found mdevd, then we should not attempt to load
this one.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 parent
e2ee372b5d
commit
c9f930c7ad
1 file changed
+10
-1
+10
-1
@@ -1430,6 +1430,7 @@ int service_register(int type, char *cfg, struct rlimit rlimit[], char *file)
|
|||||||
char *id = NULL, *env = NULL, *cgroup = NULL;
|
char *id = NULL, *env = NULL, *cgroup = NULL;
|
||||||
char *pre_script = NULL, *post_script = NULL;
|
char *pre_script = NULL, *post_script = NULL;
|
||||||
char *ready_script = NULL, *conflict = NULL;
|
char *ready_script = NULL, *conflict = NULL;
|
||||||
|
char ident[MAX_IDENT_LEN];
|
||||||
char *ifstmt = NULL;
|
char *ifstmt = NULL;
|
||||||
char *notify = NULL;
|
char *notify = NULL;
|
||||||
struct tty tty = { 0 };
|
struct tty tty = { 0 };
|
||||||
@@ -1554,8 +1555,16 @@ int service_register(int type, char *cfg, struct rlimit rlimit[], char *file)
|
|||||||
}
|
}
|
||||||
|
|
||||||
name = parse_name(cmd, name);
|
name = parse_name(cmd, name);
|
||||||
if (!id)
|
strlcpy(ident, name, sizeof(ident));
|
||||||
|
if (!id) {
|
||||||
id = "";
|
id = "";
|
||||||
|
} else {
|
||||||
|
strlcat(ident, ":", sizeof(ident));
|
||||||
|
strlcat(ident, id, sizeof(ident));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ifstmt && !svc_ifthen(1, ident, ifstmt))
|
||||||
|
return 0;
|
||||||
|
|
||||||
levels = conf_parse_runlevels(runlevels);
|
levels = conf_parse_runlevels(runlevels);
|
||||||
if (runlevel != INIT_LEVEL && !ISOTHER(levels, INIT_LEVEL)) {
|
if (runlevel != INIT_LEVEL && !ISOTHER(levels, INIT_LEVEL)) {
|
||||||
|
|||||||
Reference in new issue
Block a user