summaryrefslogtreecommitdiff
path: root/src/getty-generator/getty-generator.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2012-05-23 03:43:29 +0200
committerLennart Poettering <lennart@poettering.net>2012-05-23 03:43:29 +0200
commit07719a21b6425d378b36bb8d7f47ad5ec5296d28 (patch)
tree5195e8b0dd74a415f0d048398b8b1d25e9112e04 /src/getty-generator/getty-generator.c
parent7c4c5f68a5dd55f33bf18ccccbc8a611703fc3e2 (diff)
downloadsystemd-07719a21b6425d378b36bb8d7f47ad5ec5296d28.tar.gz
manager: rework generator logic
Previously generated units were always placed at the end of the search path. With this change there will be three unit dirs instead of one, to place generated entries at the beginning, in the middle and at the end of the search path: beginning: for units that need to override all configuration, regardless of user or vendor. Example use: system-update-generator uses this to temporarily redirect default.target. middle: for units that need to override vendor configuration, but not vendor configuration. Example use: /etc/fstab should override vendor supplied configuration (think /tmp), but should not override native user configuration. end: does not override anything but is available as well. Possible usage might be to convert D-Bus bus service files to native units but allowing vendor supplied native units to win.
Diffstat (limited to 'src/getty-generator/getty-generator.c')
-rw-r--r--src/getty-generator/getty-generator.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/getty-generator/getty-generator.c b/src/getty-generator/getty-generator.c
index b2e4f52c3c..85600263f9 100644
--- a/src/getty-generator/getty-generator.c
+++ b/src/getty-generator/getty-generator.c
@@ -38,8 +38,8 @@ static int add_symlink(const char *fservice, const char *tservice) {
assert(fservice);
assert(tservice);
- asprintf(&from, SYSTEM_DATA_UNIT_PATH "/%s", fservice);
- asprintf(&to, "%s/getty.target.wants/%s", arg_dest, tservice);
+ from = strappend(SYSTEM_DATA_UNIT_PATH "/", fservice);
+ to = join(arg_dest,"/getty.target.wants/", tservice, NULL);
if (!from || !to) {
log_error("Out of memory");
@@ -99,20 +99,20 @@ int main(int argc, char *argv[]) {
char *active;
const char *j;
- if (argc > 2) {
- log_error("This program takes one or no arguments.");
+ if (argc > 1 && argc != 4) {
+ log_error("This program takes three or no arguments.");
return EXIT_FAILURE;
}
+ if (argc > 1)
+ arg_dest = argv[1];
+
log_set_target(LOG_TARGET_SAFE);
log_parse_environment();
log_open();
umask(0022);
- if (argc > 1)
- arg_dest = argv[1];
-
if (detect_container(NULL) > 0) {
log_debug("Automatically adding console shell.");