static int help(void) {
printf("%s [options]\n\n"
+ "Install init system units.\n\n"
" -h --help Show this help\n"
" --force Override existing links\n"
" --system Install into system\n"
/* This is a minimal version of unit_name_valid() from
* unit-name.c */
- if (strchr(name, '/'))
- return false;
-
if (!*name)
return false;
if ((r = create_symlink(i->path, alias_path)) != 0)
goto finish;
+
+ if (arg_action == ACTION_DISABLE)
+ rmdir_parents(alias_path, config_path);
}
r = 0;
if ((r = create_symlink(i->path, alias_path)) != 0)
goto finish;
- if (arg_action == ACTION_DISABLE) {
- char *t;
-
- /* Try to remove .wants dir if we don't need it anymore */
- if (asprintf(&t, "%s/%s.wants", config_path, *s) >= 0) {
- rmdir(t);
- free(t);
- }
- }
+ if (arg_action == ACTION_DISABLE)
+ rmdir_parents(alias_path, config_path);
}
r = 0;
zero(paths);
- log_set_target(LOG_TARGET_CONSOLE);
- log_set_max_level(LOG_INFO);
log_parse_environment();
if ((r = parse_argv(argc, argv)) < 0)