static char **arg_wall = NULL;
static const char *arg_kill_who = NULL;
static const char *arg_kill_mode = NULL;
static char **arg_wall = NULL;
static const char *arg_kill_who = NULL;
static const char *arg_kill_mode = NULL;
- if (!(filename = path_make_absolute(i->name, *p))) {
+ if (arg_root)
+ should_free = path = strappend(arg_root, *p);
+ else {
+ should_free = NULL;
+ path = *p;
+ }
+
+ if (!(filename = path_make_absolute(i->name, path))) {
/* Ensure that we don't follow symlinks */
if ((fd = open(filename, O_RDONLY|O_CLOEXEC|O_NOFOLLOW|O_NOCTTY)) >= 0)
if ((f = fdopen(fd, "re")))
/* Ensure that we don't follow symlinks */
if ((fd = open(filename, O_RDONLY|O_CLOEXEC|O_NOFOLLOW|O_NOCTTY)) >= 0)
if ((f = fdopen(fd, "re")))
- exists = access(sysv, F_OK) >= 0;
+ if (arg_root) {
+ char *tmp_path;
+
+ tmp_path = strappend (arg_root, sysv);
+ exists = access (tmp_path, F_OK) >= 0;
+ free (tmp_path);
+ } else
+ exists = access(sysv, F_OK) >= 0;
argv[2] =
streq(verb, "enable") ? "on" :
streq(verb, "disable") ? "off" : "--level=5";
argv[2] =
streq(verb, "enable") ? "on" :
streq(verb, "disable") ? "off" : "--level=5";
- log_info("Executing %s %s %s", argv[0], argv[1], strempty(argv[2]));
+ log_info("Executing %s %s %s %s", argv[0], argv[1], strempty(argv[2]), strempty(argv[3]));
/* Consider unit files stored in /lib and /usr always enabled
* if they have no [Install] data. */
if (streq(verb, "is-enabled") &&
strv_isempty(i->aliases) &&
strv_isempty(i->wanted_by) &&
/* Consider unit files stored in /lib and /usr always enabled
* if they have no [Install] data. */
if (streq(verb, "is-enabled") &&
strv_isempty(i->aliases) &&
strv_isempty(i->wanted_by) &&
- !path_startswith(filename, "/etc"))
- return 1;
-
- i->path = filename;
-
- if ((r = config_parse(filename, f, NULL, items, true, i)) < 0) {
+ !path_startswith(filename, "/etc")) {
/* Don't try to reload anything if we are called for system changes but the system wasn't booted with systemd */
(arg_user || sd_booted() > 0) &&
/* Don't try to reload anything if we are running in a chroot environment */
/* Don't try to reload anything if we are called for system changes but the system wasn't booted with systemd */
(arg_user || sd_booted() > 0) &&
/* Don't try to reload anything if we are running in a chroot environment */
" Do not ask for system passwords\n"
" --order When generating graph for dot, show only order\n"
" --require When generating graph for dot, show only requirement\n"
" Do not ask for system passwords\n"
" --order When generating graph for dot, show only order\n"
" --require When generating graph for dot, show only requirement\n"
" --system Connect to system manager\n"
" --user Connect to user service manager\n"
" --global Enable/disable unit files globally\n"
" --system Connect to system manager\n"
" --user Connect to user service manager\n"
" --global Enable/disable unit files globally\n"
{ "quiet", no_argument, NULL, 'q' },
{ "order", no_argument, NULL, ARG_ORDER },
{ "require", no_argument, NULL, ARG_REQUIRE },
{ "quiet", no_argument, NULL, 'q' },
{ "order", no_argument, NULL, ARG_ORDER },
{ "require", no_argument, NULL, ARG_REQUIRE },
{ "force", no_argument, NULL, 'f' },
{ "no-reload", no_argument, NULL, ARG_NO_RELOAD },
{ "defaults", no_argument, NULL, ARG_DEFAULTS },
{ "force", no_argument, NULL, 'f' },
{ "no-reload", no_argument, NULL, ARG_NO_RELOAD },
{ "defaults", no_argument, NULL, ARG_DEFAULTS },
-static int send_shutdownd(usec_t t, char mode, bool warn, const char *message) {
+static int send_shutdownd(usec_t t, char mode, bool dry_run, bool warn, const char *message) {
- r = send_shutdownd(0, 0, false, NULL);
+ r = send_shutdownd(0, 0, false, false, NULL);