diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2013-01-28 22:34:38 -0500 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2013-01-29 19:01:41 -0500 |
commit | 3f0b2f0f452e94444e4fb7b62030ea05738bb1b6 (patch) | |
tree | 8429adf52808221ed9e9be24e57a2e8e508aefc6 /src/shared/install.c | |
parent | 7584d236eac91f9b7128b1eb08bddf18be2bce9f (diff) |
install: allow %u an and %U specifiers in WantedBy/RequiredBy/Alias
Diffstat (limited to 'src/shared/install.c')
-rw-r--r-- | src/shared/install.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/shared/install.c b/src/shared/install.c index 7fb352cfff..b82d1891dd 100644 --- a/src/shared/install.c +++ b/src/shared/install.c @@ -956,6 +956,33 @@ static int config_parse_also( return 0; } +static int config_parse_user( + const char *filename, + unsigned line, + const char *section, + const char *lvalue, + int ltype, + const char *rvalue, + void *data, + void *userdata) { + + InstallInfo *i = data; + char* printed; + + assert(filename); + assert(lvalue); + assert(rvalue); + + printed = install_full_printf(i, rvalue); + if (!printed) + return -ENOMEM; + + free(i->user); + i->user = printed; + + return 0; +} + static int unit_file_load( InstallContext *c, InstallInfo *info, @@ -967,6 +994,7 @@ static int unit_file_load( { "Install", "WantedBy", config_parse_strv, 0, &info->wanted_by }, { "Install", "RequiredBy", config_parse_strv, 0, &info->required_by }, { "Install", "Also", config_parse_also, 0, c }, + { "Exec", "User", config_parse_user, 0, info }, { NULL, NULL, NULL, 0, NULL } }; |