chiark / gitweb /
networkd: netdev - add ipvlan support
[elogind.git] / src / systemctl / systemctl.c
index ded4943c106146c3d99e9cce1b1755052b2d16d6..c02a76c6cd22df590ed029cf3224e65231b6c0e8 100644 (file)
@@ -434,14 +434,12 @@ static int output_units_list(const UnitInfo *unit_infos, unsigned c) {
 
                 n_shown++;
 
-                if (STR_IN_SET(u->load_state, "error", "not-found", "masked")) {
+                if (STR_IN_SET(u->load_state, "error", "not-found", "masked") && !arg_plain) {
                         on_loaded = ansi_highlight_red();
                         on_circle = ansi_highlight_yellow();
                         off_loaded = off_circle = ansi_highlight_off();
                         circle = true;
-                }
-
-                if (streq(u->active_state, "failed")) {
+                } else if (streq(u->active_state, "failed") && !arg_plain) {
                         on_circle = on_active = ansi_highlight_red();
                         off_circle = off_active = ansi_highlight_off();
                         circle = true;
@@ -1614,8 +1612,6 @@ static int list_dependencies_one(
         qsort_safe(deps, strv_length(deps), sizeof (char*), list_dependencies_compare);
 
         STRV_FOREACH(c, deps) {
-                int state;
-
                 if (strv_contains(*units, *c)) {
                         if (!arg_plain) {
                                 r = list_dependencies_print("...", level + 1, (branches << 1) | (c[1] == NULL ? 0 : 1), 1);
@@ -1625,11 +1621,16 @@ static int list_dependencies_one(
                         continue;
                 }
 
-                state = check_one_unit(bus, *c, "activating\0active\0reloading\0", true);
-                if (state > 0)
-                        printf("%s%s%s ", ansi_highlight_green(), draw_special_char(DRAW_BLACK_CIRCLE), ansi_highlight_off());
-                else
-                        printf("%s%s%s ", ansi_highlight_red(), draw_special_char(DRAW_BLACK_CIRCLE), ansi_highlight_off());
+                if (arg_plain)
+                        printf("  ");
+                else {
+                        int state;
+                        const char *on;
+
+                        state = check_one_unit(bus, *c, "activating\0active\0reloading\0", true);
+                        on = state > 0 ? ansi_highlight_green() : ansi_highlight_red();
+                        printf("%s%s%s ", on, draw_special_char(DRAW_BLACK_CIRCLE), ansi_highlight_off());
+                }
 
                 r = list_dependencies_print(*c, level, branches, c[1] == NULL);
                 if (r < 0)
@@ -1825,7 +1826,7 @@ static void output_machines_list(struct machine_info *machine_infos, unsigned n)
                 failedlen = MAX(failedlen, DECIMAL_STR_WIDTH(m->n_failed_units));
                 jobslen = MAX(jobslen, DECIMAL_STR_WIDTH(m->n_jobs));
 
-                if (!arg_no_legend && !streq_ptr(m->state, "running"))
+                if (!arg_plain && !streq_ptr(m->state, "running"))
                         circle_len = 2;
         }
 
@@ -2035,10 +2036,12 @@ static void output_jobs_list(const struct job_info* jobs, unsigned n, bool skipp
         assert(n == 0 || jobs);
 
         if (n == 0) {
-                on = ansi_highlight_green();
-                off = ansi_highlight_off();
+                if (!arg_no_legend) {
+                        on = ansi_highlight_green();
+                        off = ansi_highlight_off();
 
-                printf("%sNo jobs %s.%s\n", on, skipped ? "listed" : "running", off);
+                        printf("%sNo jobs %s.%s\n", on, skipped ? "listed" : "running", off);
+                }
                 return;
         }
 
@@ -5669,7 +5672,7 @@ static int create_edit_temp_file(const char *new_path, const char *original_path
                 return r;
         }
 
-        r = copy_file(original_path, t, 0, 0644);
+        r = copy_file(original_path, t, 0, 0644, 0);
         if (r == -ENOENT) {
                 r = touch(t);
                 if (r < 0) {
@@ -6002,8 +6005,8 @@ static void systemctl_help(void) {
                "                      Operate on remote host\n"
                "  -M --machine=CONTAINER\n"
                "                      Operate on local container\n"
-               "  -t --type=TYPE      List only units of a particular type\n"
-               "     --state=STATE    List only units with particular LOAD or SUB or ACTIVE state\n"
+               "  -t --type=TYPE      List units of a particular type\n"
+               "     --state=STATE    List units with particular LOAD or SUB or ACTIVE state\n"
                "  -p --property=NAME  Show only properties by this name\n"
                "  -a --all            Show all loaded units/properties, including dead/empty\n"
                "                      ones. To list all units installed on the system, use\n"
@@ -6021,8 +6024,7 @@ static void systemctl_help(void) {
                "  -q --quiet          Suppress output\n"
                "     --no-block       Do not wait until operation finished\n"
                "     --no-wall        Don't send wall message before halt/power-off/reboot\n"
-               "     --no-reload      When enabling/disabling unit files, don't reload daemon\n"
-               "                      configuration\n"
+               "     --no-reload      Don't reload daemon after en-/dis-abling unit files\n"
                "     --no-legend      Do not print a legend (column headers and hints)\n"
                "     --no-pager       Do not pipe output into a pager\n"
                "     --no-ask-password\n"
@@ -6031,12 +6033,12 @@ static void systemctl_help(void) {
                "     --runtime        Enable unit files only temporarily until next reboot\n"
                "  -f --force          When enabling unit files, override existing symlinks\n"
                "                      When shutting down, execute action immediately\n"
-               "     --preset-mode=   Specifies whether fully apply presets, or only enable,\n"
-               "                      or only disable\n"
+               "     --preset-mode=   Apply only enable, only disable, or all presets\n"
                "     --root=PATH      Enable unit files in the specified root directory\n"
                "  -n --lines=INTEGER  Number of journal entries to show\n"
-               "  -o --output=STRING  Change journal output mode (short, short-monotonic,\n"
-               "                      verbose, export, json, json-pretty, json-sse, cat)\n"
+               "  -o --output=STRING  Change journal output mode (short, short-iso,\n"
+               "                              short-precise, short-monotonic, verbose,\n"
+               "                              export, json, json-pretty, json-sse, cat)\n"
                "     --plain          Print unit dependencies as a list instead of a tree\n\n"
                "Unit Commands:\n"
                "  list-units [PATTERN...]         List loaded units\n"
@@ -6075,7 +6077,7 @@ static void systemctl_help(void) {
                "                                  based on preset configuration\n"
                "  preset-all                      Enable/disable all unit files based on\n"
                "                                  preset configuration\n"
-               "  is-enabled NAME...              Check whether unit files are enabled\n\n"
+               "  is-enabled NAME...              Check whether unit files are enabled\n"
                "  mask NAME...                    Mask one or more units\n"
                "  unmask NAME...                  Unmask one or more units\n"
                "  link PATH...                    Link one or more units files into\n"
@@ -6084,10 +6086,9 @@ static void systemctl_help(void) {
                "                                  on specified one or more units\n"
                "  add-requires TARGET NAME...     Add 'Requires' dependency for the target\n"
                "                                  on specified one or more units\n"
-               "  get-default                     Get the name of the default target\n"
-               "  set-default NAME                Set the default target\n"
                "  edit NAME...                    Edit one or more unit files\n"
-               "\n"
+               "  get-default                     Get the name of the default target\n"
+               "  set-default NAME                Set the default target\n\n"
                "Machine Commands:\n"
                "  list-machines [PATTERN...]      List local containers and host\n\n"
                "Job Commands:\n"
@@ -6100,7 +6101,7 @@ static void systemctl_help(void) {
                "  show-environment                Dump environment\n"
                "  set-environment NAME=VALUE...   Set one or more environment variables\n"
                "  unset-environment NAME...       Unset one or more environment variables\n"
-               "  import-environment NAME...      Import all, one or more environment variables\n\n"
+               "  import-environment [NAME...]    Import all or some environment variables\n\n"
                "Manager Lifecycle Commands:\n"
                "  daemon-reload                   Reload systemd manager configuration\n"
                "  daemon-reexec                   Reexecute systemd manager\n\n"